From 6c20227d7e65d55f8a64e7992f5013ffeab81d0d Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 29 Jul 2021 00:34:02 +0200 Subject: Update the Apache and nginx configuration files --- .ht-nginx | 18 +++++++++++------- .htaccess | 29 ++++++++++++++++------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.ht-nginx b/.ht-nginx index 6b97cb8..ba8a9b2 100644 --- a/.ht-nginx +++ b/.ht-nginx @@ -1,16 +1,22 @@ #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# -# nginx configuration rules [Thomas Lange ] # +# nginx configuration [Thomas Lange ] # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# # # # This file contains the configuration from the Apaches .htaccess file written # # for the nginx high performance web server. Put the content of this file into # # the "server {}" block of your nginx virtual host configuration file. If your # -# blog installation is within a sub directory, you need to adjust this values! # +# blog is installed in a sub directory, you might need to adjust this rules! # +# # +# How to setup PHP and passing requests via FastCGI to PHP-FPM is your job. If # +# you encounter a "403 Forbidden" error on the home page, please make sure you # +# have configured your nginx virtual host to look for an index.php file: # +# # +# index index.php [...]; # # # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# #=============================================================================== -# Error documents +# Error pages #=============================================================================== error_page 403 /403.php; error_page 404 /404.php; @@ -23,8 +29,6 @@ location ~ ^/(.git|core|theme/([^/]+)/(html|lang)/) { } #=============================================================================== -# Main rules +# Pass requests to index.php #=============================================================================== -if (!-e $request_filename) { - rewrite ^(.*)$ /index.php break; -} +try_files $uri $uri/ /index.php?$args; diff --git a/.htaccess b/.htaccess index b3203b2..e337dde 100644 --- a/.htaccess +++ b/.htaccess @@ -1,24 +1,28 @@ #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# -# Apache configuration rules [Thomas Lange ] # +# Apache configuration [Thomas Lange ] # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# # # -# This file contains rewrite rules for Apache. It's recommended to include the # -# rules directly into your Apache configuration for a better performance. Also # -# disable the AllowOverride directive within your Apache virtualhost (if it is # -# not already globally disabled for performance and security reasons both). # +# This file contains the configuration rules for the Apache HTTP server. It is # +# recommended to include these rules directly into the Apache configuration! # +# # +# Additionally, it's recommended to ensure that the AllowOverride directive is # +# disabled if these rules are included in the Apache configuration. Otherwise, # +# the Apache HTTP server is checking for .htaccess files on every request. # +# # +# AllowOverride None # # # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# #=============================================================================== -# Enable RewriteEngine +# Error pages #=============================================================================== -RewriteEngine On +ErrorDocument 403 /403.php +ErrorDocument 404 /404.php #=============================================================================== -# ErrorDocument handler +# Enable RewriteEngine #=============================================================================== -ErrorDocument 403 /403.php -ErrorDocument 404 /404.php +RewriteEngine On #=============================================================================== # Forbidden directories @@ -26,9 +30,8 @@ ErrorDocument 404 /404.php RewriteRule ^(.git|core|theme/([^/]+)/(html|lang)/) - [F] #=============================================================================== -# Main rules +# Pass requests to index.php #=============================================================================== RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - -RewriteRule ^(.*)$ index.php [L] +RewriteRule . index.php [L] -- cgit v1.2.3