该页面未在 Wamp 服务器中正确重定向
The page isn't redirecting properly in Wamp Server
我在网上上传了 Php 文件,登录系统工作正常,但同样的代码在本地主机上不工作。我正在使用 WAMP 服务器。它总是说 "The page isn't redirecting properly"。
This is My .htaccess file
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^74\.208\.90\.60
RewriteCond %{HTTP_HOST} !^localhost:8080/gdev
RewriteRule (.*) [localhost] [R=301,L,QSA]
这个有很多问题:
- 将
\
放在第一个 RewriteCond
中。
- 你的第二个
RewriteCond
没有意义。 localhost:8080/gdev
中与 %{HTTP_HOST}
相关的唯一部分是 localhost
。您不能使用这一规则来检查主机、端口和路径。
- 你的
RewriteRule
没有意义。重定向到 [localhost]
就像重定向到 http://whatever/[localhost]
。它不会更改端口。
我不是 100% 了解您想要做的事情,但我建议您先阅读 RewriteCond
and RewriteRule
指令。
我在网上上传了 Php 文件,登录系统工作正常,但同样的代码在本地主机上不工作。我正在使用 WAMP 服务器。它总是说 "The page isn't redirecting properly"。
This is My .htaccess file
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^74\.208\.90\.60
RewriteCond %{HTTP_HOST} !^localhost:8080/gdev
RewriteRule (.*) [localhost] [R=301,L,QSA]
这个有很多问题:
- 将
\
放在第一个RewriteCond
中。 - 你的第二个
RewriteCond
没有意义。localhost:8080/gdev
中与%{HTTP_HOST}
相关的唯一部分是localhost
。您不能使用这一规则来检查主机、端口和路径。 - 你的
RewriteRule
没有意义。重定向到[localhost]
就像重定向到http://whatever/[localhost]
。它不会更改端口。
我不是 100% 了解您想要做的事情,但我建议您先阅读 RewriteCond
and RewriteRule
指令。