mod rewrite single url.php
如何用下面的代码重写单个URLmod rewrite single url.php,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,如何用下面的代码重写单个URL Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R,L,NC] RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^ %{REQUEST_URI}.php [L] 您可以更
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
您可以更改正则表达式模式,使其仅成为目标
home.php
:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+(home)\.php[?/\s] [NC]
RewriteRule ^ %1 [R=301,L]
RewriteRule ^(home)/?$ $1.php [L]
目前还不清楚问题出在哪里。你能用一个例子说明一下吗?只想把/home.php重写为/home-我不想重写所有的.php URL