Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mod rewrite single url.php_Php_.htaccess_Mod Rewrite - Fatal编程技术网

mod rewrite single url.php

mod 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] 您可以更

如何用下面的代码重写单个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]

您可以更改正则表达式模式,使其仅成为目标
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