Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.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
Apache 位置栏没有';不显示重定向的URL_Apache_Mod Rewrite_Httpd.conf - Fatal编程技术网

Apache 位置栏没有';不显示重定向的URL

Apache 位置栏没有';不显示重定向的URL,apache,mod-rewrite,httpd.conf,Apache,Mod Rewrite,Httpd.conf,这是我的httpd.conf文件http://old.example.com: RewriteEngine on RewriteBase / RewriteRule ^login$ http://another.example.com/login [L] 问题是尽管我可以重定向到http://another.example.com/login,但位置栏仍显示http://old.example.com/login 知道如何解决这个问题吗?如果在中使用mod_rewrite,则始终需要在模

这是我的
httpd.conf文件http://old.example.com

RewriteEngine on
RewriteBase /
RewriteRule ^login$  http://another.example.com/login   [L]
问题是尽管我可以重定向到
http://another.example.com/login
,但位置栏仍显示
http://old.example.com/login


知道如何解决这个问题吗?

如果在中使用mod_rewrite,则始终需要在模式中指定完整的URL路径:

RewriteRule ^/login$ http://another.example.com/login [L,R]
仅当在每个目录上下文中使用(如在.htaccess文件中使用)时,您只需要指定相对URL路径,而不需要上下文路径前缀

并通过设置以下选项尝试显式重定向:

这样,您还可以指定状态代码:

RewriteRule ^/login$ http://another.example.com/login [L,R=301]

如果在中使用mod_rewrite,则始终需要在模式中指定完整的URL路径:

RewriteRule ^/login$ http://another.example.com/login [L,R]
仅当在每个目录上下文中使用(如在.htaccess文件中使用)时,您只需要指定相对URL路径,而不需要上下文路径前缀

并通过设置以下选项尝试显式重定向:

这样,您还可以指定状态代码:

RewriteRule ^/login$ http://another.example.com/login [L,R=301]