2011-02-25 131 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