Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.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 多写规则中的问题_Mod Rewrite - Fatal编程技术网

Mod rewrite 多写规则中的问题

Mod rewrite 多写规则中的问题,mod-rewrite,Mod Rewrite,您已使用“重写url”模块,但无法重定向到目标页面,我收到错误消息,因为在此服务器上找不到请求的url/old.html 这是我的密码。请注意这一点,并向我建议: RewriteEngine On RewriteCond %{SERVER_PORT} !^8080$ RewriteRule ^(.*)$ http://localhost/IN/$1 [L,R] RewriteRule ^new.html$ /index.html$1 [L] 您的第一条规则可能会导致无限规则,因为替代URL也

您已使用“重写url”模块,但无法重定向到目标页面,我收到错误消息,因为在此服务器上找不到请求的url
/old.html

这是我的密码。请注意这一点,并向我建议:

RewriteEngine On
RewriteCond  %{SERVER_PORT} !^8080$
RewriteRule ^(.*)$ http://localhost/IN/$1 [L,R]
RewriteRule ^new.html$ /index.html$1 [L]

您的第一条规则可能会导致无限规则,因为替代URL也不使用端口8080。所以试试这个:

RewriteCond  %{SERVER_PORT} !^8080$
RewriteRule ^(.*)$ http://localhost:8080/IN/$1 [L,R]
您还需要请求
/new.html
,以查看第二条规则是否有效。此外,模式中没有第一个组的匹配项可以被
$1
引用。因此:

RewriteRule ^new\.html$ /index.html [L]