2013-10-08 26 views
0

我試圖重定向像網頁:重定向子域名與htaccess的新域

RewriteCond %{HTTP_HOST} c\.domain1\.se$ [NC] 
RewriteRule^domain2.se%{REQUEST_URI} [QSA,R=301,L,NE] 

我得到如下:

c.domain1.se/folder1/main.html 

www.domain2.se/folder1/main.html 

我htaccess的是這樣的消息:

Forbidden 
You don't have permission to access /set on this server. 

Webhost聲稱沒有其他htaccess文件干擾c.domain1.se上的文件。

任何想法可能是什麼問題?

回答

0

您應該包括在規則的目標方案,並添加邊界條件匹配(通過^):

RewriteCond %{HTTP_HOST} ^c\.domain1\.se$ [NC] 
RewriteRule^http://domain2.se%{REQUEST_URI} [QSA,R=301,L,NE] 
0

試試這個代碼:

RewriteCond %{HTTP_HOST} ^c\.domain1\.se$ [NC] 
RewriteRule^http://domain2.se%{REQUEST_URI} [R=301,L,NE]