diff --git a/src/cookbook/configuring-webservers/apache.md b/src/cookbook/configuring-webservers/apache.md index 9d21bc40..5e82c8d5 100644 --- a/src/cookbook/configuring-webservers/apache.md +++ b/src/cookbook/configuring-webservers/apache.md @@ -11,8 +11,9 @@ DocumentRoot "path/to/app/public" # use mod_rewrite for pretty URL support RewriteEngine on - # if $showScriptName is false in UrlManager, do not allow accessing URLs with script name - RewriteRule ^index.php/ - [L,R=404] + # Do not allow access to URLs with a script name + RewriteCond %{THE_REQUEST} index.php [NC] + RewriteRule . - [R=404,L] # If a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f @@ -34,8 +35,9 @@ using `httpd.conf`: # use mod_rewrite for pretty URL support RewriteEngine on -# if $showScriptName is false in UrlManager, do not allow accessing URLs with script name -RewriteRule ^index.php/ - [L,R=404] +# Do not allow access to URLs with a script name +RewriteCond %{THE_REQUEST} index.php [NC] +RewriteRule . - [R=404,L] # If a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f