newbie
newbie

Reputation: 29

non-www to www htaccess redirect

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!

Upvotes: 2

Views: 711

Answers (2)

Stephan Muller
Stephan Muller

Reputation: 27600

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.example.net/$1 [R,L]

Upvotes: 2

atamanroman
atamanroman

Reputation: 11808

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] 

Upvotes: 3

Related Questions