WebFaction
Community site: login faq

I got this if we want www to be redirected to a naked domain.

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

Whats the other way round ? I always want www.

asked 18 Jul '13, 02:57

epqrs
16921131
accept rate: 0%


We suggest using a redirect application as the best way to redirect the domain to www. The actual .htaccess contents would be as follows.

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

Please make sure that you substitute the actual domain in place of example.com.

permanent link

answered 18 Jul '13, 07:44

aaront ♦♦
7564
accept rate: 27%

Why do you suggest a redirect app when this works ?

(19 Jul '13, 08:15) epqrs

The redirect app is not required - you can certainly make the same changes in many of the individual apps to be redirected. The redirect app is is useful in multiple ways. For example, it gives you the ability to use the redirects with websites that would not otherwise be able to use the .htaccess file. It's also possible to create a redirect app that can redirect multiple sites at once - if you ever need to change the redirect, you'll only need to change it once instead of once for each site.

I hope this helps!

permanent link

answered 19 Jul '13, 14:43

maryh ♦♦
1.3k7
accept rate: 35%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×74
×10

question asked: 18 Jul '13, 02:57

question was seen: 1,945 times

last updated: 19 Jul '13, 14:43

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM