使用.htaccess重定向

时间:2011-01-04 11:36:41

标签: apache .htaccess mod-rewrite

我在piscolabis.info的cpanel上有一个有针对性的域名keepyourlinks.com,所以如果你去piscolabis.info/keepyourlinks.com/你可以访问它而我不想要那个,我正在尝试:

RewriteCond %{HTTP_HOST} ^piscolabis.info/keepyourlinks.com/ [NC]
RewriteRule ^(.*)$ http://keepyourlinks.com/$1 [L,R=301]

但它不起作用......:S

1 个答案:

答案 0 :(得分:1)

这应该有效:

RewriteCond %{HTTP_HOST} ^piscolabis.info$
RewriteCond %{REQUEST_URI} ^/keepyourlinks.com [NC]
RewriteRule ^(.*)$ http://keepyourlinks.com/$1 [L,R=301]