Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Here is some code that will allow you to make all requests to your site have "www" in front of it.

All sites we host by default can be accessed with and without the www, but some of you would like "www" only style urlsURLs. Modify your .htaccess file with the following lines of code, using what is appropriate for your web server version.


Code:
 
Code Block
languagetext
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
 


In Apache 2.x you might try:

Code:
 

Code Block
languagetext
RewriteEngine On
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com$
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]

 

 



Content by Label
showLabelsfalse
maxspaces5GKB
spacesshowSpaceGKBfalse
sortmodifiedshowSpacefalse
reversetrue
typepage
cqllabel in ("www","url","redirect","mod_rewrite","htaccess") and type = "page" and space = "GKB"
labelsmod_rewrite redirect www url

Page properties
hiddentrue
Related issues