Mod rewrite 多写规则中的问题
您已使用“重写url”模块,但无法重定向到目标页面,我收到错误消息,因为在此服务器上找不到请求的urlMod 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也
/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]