如何在.htaccess

时间:2017-05-15 00:25:53

标签: .htaccess

您能帮助我将此功能转换为“RewriteRule”格式吗?

RedirectMatch 301 ^/auth/(.*) http://1.1.10.7/auth/$1

我需要更改此格式,因为这会导致重定向循环,我想添加RewriteCond %{HTTP_HOST} !=1.1.10.7

我尝试了这个,但不起作用:

RewriteCond %{HTTP_HOST} !=1.1.10.7 RewriteRule ^kubota-store-admin$ http://10.1.1.36/kubota-store-admin/$1 [L,NC,NE,R=301]

我需要的结果是:

有人可以帮忙吗?感谢。

1 个答案:

答案 0 :(得分:1)

您需要检查http_host字符串是否为" example.com"它不应与目标主机匹配

RewriteEngine on

RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^auth/(.*)$ http://1.1.10.7/auth/$1 [L,R]

在测试之前清除浏览器缓存。

相关问题