0

How to use mod_rewrite for ip instead of domain name.

for domain i am using like this

RewriteCond %{HTTP_HOST} ^treasherlocked.in
RewriteRule (.*) http://www.treasherlocked.in/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.treasherlocked.in/ [R=301,L]

for ip i am using like this , but it is not wokring

RewriteCond %{HTTP_HOST} ^118\.139\.160\.117
RewriteRule (.*) http://118.139.160.117/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://118.139.160.117/ [R=301,L]
4

1 回答 1

2

替换此行

RewriteCond %{HTTP_HOST} ^118\.139\.160\.117

RewriteCond %{REMOTE_ADDR} ^118\.139\.160\.117

你的问题就会得到解决。

于 2013-11-14T14:11:40.593 回答