Support Forums

Full Version: Trying to force www in URL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to force the 'www' in my site URL putting this in the .htaccess file in the root folder:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.jdbar\.co.cc [NC]
RewriteRule ^(.*)$ http://www.jdbar.co.cc/$1 [R=301,L]

I don't know if I'm doing it right. I just copied and pasted it from somewhere.

Anyways, it isn't working. When I type in http://jdbar.co.cc/ it doesn't direct to www.jdbar.co.cc. Instead I get an error page from Firefox saying "The page isn't redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

I have no idea how to get it working. Can anyone help?

EDIT:
I haven't resolved it yet, so I just put some Javascript on the home page to redirect it to the same home page but with www at the beginning for now... (and changed all in-site links to have the full www URL in them)
You need to add Alias to your host. I dont know how to name it on English. In your host there is option to add that.
If you use a cPanel just make it redirect with www. i know it's an option on there.
Hey JDBar, after reading your problem, searching for a bit and then testing the results on my own website, this seems to work: (replace the code your recently added in .htaccess with the following)

RewriteEngine on

Options FollowSymlinks

rewritecond %{http_host} ^jdbar.co.cc [nc]

rewriterule ^(.*)$ http://www.jdbar.co.cc/$1 [r=301,nc]

Good luck.
You need to change your DNS records who your domain is hosted with.