I use it.
Apache, want to use. htaccess implements the ability to rewrite URLs, but encounters a magical problem that cannot be resolved, first look at my rewrite rule, my. htaccess file:
RewriteEngine onRewriteCond $1 !^(index\.php|public)RewriteRule ^(.*)$ /PFW/index.php?$1 [L]
With this rule, you can forward most of the path access to the index.php page, for example:
http://localhost/test/= Http://localhost/index.php?/test
Http://localhost/example = Http://localhost/index.php?/example
However, the only path that cannot be forwarded to index.php:
http://localhost/index///This path will be accessed directly, and will not be located to index.php
The initial figure is because there is a index.php file under the directory, because when I create test.php in the same directory in index.php:
http://localhost/test///This path will not be forwarded, before it can be forwarded
That is, when the directory has a PHP file with the same name as the path, my. htaccess rewrite rule will not take effect. I wonder if anyone has ever met the same problem as me? Until now have not thought the solution, asks everybody to point the maze t^t
This issue has been closed due to:
Reply content:
I use Apache, I want to use the. htaccess implementation of the function of rewriting the URL, but encountered a very magical problem can not be resolved, first look at my rewrite rules, my. htaccess file:
RewriteEngine onRewriteCond $1 !^(index\.php|public)RewriteRule ^(.*)$ /PFW/index.php?$1 [L]
With this rule, you can forward most of the path access to the index.php page, for example:
http://localhost/test/= Http://localhost/index.php?/test
Http://localhost/example = Http://localhost/index.php?/example
However, the only path that cannot be forwarded to index.php:
http://localhost/index///This path will be accessed directly, and will not be located to index.php
The initial figure is because there is a index.php file under the directory, because when I create test.php in the same directory in index.php:
http://localhost/test///This path will not be forwarded, before it can be forwarded
That is, when the directory has a PHP file with the same name as the path, my. htaccess rewrite rule will not take effect. I wonder if anyone has ever met the same problem as me? Until now have not thought the solution, asks everybody to point the maze t^t
Give it a try.
RewriteEngine On#RewriteBase ...RewriteRule ^(index\.php$|public.*) $1 [QSA,L]RewriteRule ^(.*)$ index.php?$1 [QSA,L]