2011-02-25 107 views
1

如何自動向www.example.com或www.example.com/blah/blah輸入以example.com或example.com形式輸入(轉換/轉換)的網址(無論術語是否正確) /等等/等等?我基本上想要推入任何與www子域進入包括路徑(如果有的話)域的任何東西。將www子域名轉發到域

+0

你沒有正確使用術語頂級域名。頂級域名是.com,.org,.co.uk等。 – 2011-02-25 05:41:36

+0

知道你正在使用哪些工具是有幫助的;這也可能會更好地詢問serverfault – thenoviceoof 2011-02-25 05:46:59

+0

謝謝你的建設性意見。 – crashintoty 2011-02-25 06:05:06

回答

4

在你的htaccess文件使用該

RewriteEngine On  
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]  
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] 
+0

謝謝!完美工作 – crashintoty 2011-02-25 06:11:46