我想从我的ip(A主机)重定向到我的网站url。前面,我在.htaccess文件中使用了以下几行代码,它工作得很好。
RewriteCond %{HTTP_HOST} ^[0-9]+(\.[0-9]+){3} [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^ http://example.com/$1 [L,R=301]上面的代码将我的ip重定向到web url。
现在,我将代码更改为以下代码,ip重定向到一个奇怪的url
RewriteCond %{HTTP_HOST} ^[0-9]+(\.[0-9]+){3} [OR]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]我想使用{REQUEST_URI}功能,同时重定向到我的基本url。这样做的正确语法是什么?
先谢谢你...
发布于 2012-07-12 07:19:05
尝试:
RewriteCond %{HTTP_HOST} ^[0-9]+(\.[0-9]+){3} [OR]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]https://stackoverflow.com/questions/11442759
复制相似问题