2015-04-28 95 views
1

我在嘗試將IP地址重定向到我的網站的域名。這是我的.htaccess文件:在.htaccess中將IP地址重定向到域名

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 

RewriteBase/

RewriteCond %{HTTP_HOST} ^198\.50\.227\.185 [nc] 
RewriteRule ^(.*)$ http://www.allrealfood.com/$1 [r=301,nc,L] 

RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 

我想不出如何得到這個工作。

+0

在默認的虛擬主機htaccess的文件或服務的IP地址的虛擬主機? –

回答

0

301(永久)重定向:

Redirect 301/http://mt-example.com/ 

302(臨時)重定向:點處的整個站點到不同的臨時URL。

Redirect 302/http://mt-example.com/ 

重定向的index.html到一個特定的子文件夾:

Redirect /index.html http://example.com/newdirectory/ 

需要了解更多的去here