如何通过index.PHP重新路由所有PHP页面请求?
我的.htaccess如下:
Options +FollowSymLinks IndexIgnore */* #Turn on the RewriteEngine RewriteEngine On # Rules RewriteCond %{REQUEST_FILENAME} !-f RewriteRule !.*\.(js|ico|gif|jpg|png|css|pdf)$index.PHP%{REQUEST_URI} [L]
基本上,我试图模仿.NET主页. index.PHP具有站点页眉/页脚.
这是我使用的(并已使用年龄):
<IfModule mod_rewrite.c> # Redirect /index.PHP to / (optional,but recommended I guess) RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.PHP RewriteRule ^index.PHP/?(.*)$$1 [R=301,L] # Run everything else but real files through index.PHP RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$index.PHP/$1?%{QUERY_STRING} [L] </IfModule>