2013-04-11 75 views
-1

幫我還挺刪除我的.htacess我真的需要的.htaccess

一條線,現在我無法打開support.sitename.com

這是我的支持文件夾, 的public_html /支持

,但我怎麼可以重定向到support.sitename.com

我寫了這一個,

#RewriteCond %{REQUEST_URI} != support.sitename.com$ 

我很確定這不是我刪除的代碼。 但它比這更接近。我遇到很大麻煩,請幫助>。 <

RewriteEngine on 
RewriteCond %{REQUEST_URI} !/$ 
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|css|gif|json|js) 
RewriteCond %{REQUEST_URI} !^/support$ 
RewriteCond %{REQUEST_URI} !^/PHPMailer$ 
RewriteCond %{REQUEST_URI} !^/scripts$ 
RewriteCond %{REQUEST_URI} !/adarna.html$ 
RewriteCond %{REQUEST_URI} !/bh6750.html$ 
RewriteCond %{REQUEST_URI} !/contact-us.html$ 
RewriteCond %{REQUEST_URI} !/dr-holmes.html$ 
RewriteCond %{REQUEST_URI} !/email.php$ 
RewriteCond %{REQUEST_URI} !/jo-rubio.html$ 
RewriteCond %{REQUEST_URI} !/npk-medical.html$ 
RewriteCond %{REQUEST_URI} !/oraderm.html$ 
RewriteCond %{REQUEST_URI} !/outsource-to-philippines.html$ 
RewriteCond %{REQUEST_URI} !/rw-chinese.html$ 
RewriteCond %{REQUEST_URI} !/rw-manila.html$ 
>> area of code i deleted 
RewriteRule (.*)/[R=301,L] 
+0

刪除#。看看怎麼回事 – 2013-04-11 03:26:26

+0

題外話;屬於[webmasters.se] – 2013-04-11 03:28:09

+0

爲什麼這個問題**'Closed' **,而不是被遷移到[Webmasters](http://webmasters.stackexchange.com/)? – 2013-04-13 00:46:14

回答

0

試試這個代碼片段

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^m\.example\.com$ 
RewriteRule^http://example.com/m%{REQUEST_URI} [L,P] 
+0

嘗試,但www.sitename.com不起作用。 :( – Shiro 2013-04-11 03:46:12

+0

您是否完好無損地保留了「$ 1」 – 2013-04-11 03:47:11

+0

是的,爲什麼我複製粘貼了您提供的代碼,並將網站名稱更改爲我的網站 – Shiro 2013-04-11 03:50:46

0

,我發現這個約:redirect support.example.com to example.com/support:

幾個不同的例子

#Turns the rewrite engine on. 
RewriteEngine on 

#Fix missing trailing slash character on folders. 
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L] 

#www.domain.com and domain.com will map to the folder {root}/folder1/ 
RewriteCond %{HTTP:Host} ^(?:www.)?domain.com$ 
RewriteCond %{REQUEST_URI} !^/folder1/ 
RewriteRule ^(.*) folder1/$1 [NC,L,NS] 

#www.otherdomain.com and otherdomain.com will map to the folder {root}/folder2/ 
RewriteCond %{HTTP:Host} ^(?:www.)?otherdomain.com$ 
RewriteCond %{REQUEST_URI} !^/folder2/ 
RewriteRule ^(.*) folder2/$1 [NC,L,NS] 

#subdomain.domain.com will map to the folder {root}/folder3/ 
RewriteCond %{HTTP:Host} ^(?:subdomain.domain.com)?$ 
RewriteCond %{REQUEST_URI} !^/folder3/ 
RewriteRule ^(.*) folder3/$1 [NC,L,NS] 
1
# it could be 
RewriteCond %{HTTP_HOST} !^support\.sitename\.com$ 
# or this 
RewriteCond %{HTTP_HOST} !^(www\.)?support\.sitename\.com$ 

# or even this 
RewriteCond %{HTTP_HOST} ^support\.sitename\.com$ 
# or this 
RewriteCond %{HTTP_HOST} ^(www\.)?support\.sitename\.com$ 

要看做什麼喲你想用你的代碼和你的代碼所在的文件名,你沒有提到。

重定向/支持/支持/support.sitename.com你已經更好地利用這些條件和規則上的的.htaccess文件

RewriteCond %{HTTP_HOST} !^(www\.)?support\.sitename\.com$ 
RewriteRule ^support/?$ http://support.sitename.com/