问题
I have a .net url which works perfectly with the www in front of it but when the url is just http://example.net its bringing up an under construction page.
I have tried all sorts of .htaccess files but nothing is working! Help!
回答1:
Im not a web developer nor a sys admin, but i think the default domain has to point to the same directory the subdomain www points to.
Imo the default is, that example.com leads to your content and www.example.com forwards to example.com. That's how it's done (according to http://no-www.org/):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
回答2:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.example.net/$1 [R,L]
来源:https://stackoverflow.com/questions/3707319/non-www-to-www-htaccess-redirect