Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to force www in URL
#1
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)
[Image: 3djdbar2notglowing.png]
Reply
#2
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.
Reply
#3
If you use a cPanel just make it redirect with www. i know it's an option on there.
Reply
#4
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.
Reply
#5
You need to change your DNS records who your domain is hosted with.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how do I allow someone to access a DB via a URL? andrewjs18 8 1,613 09-08-2011, 12:42 PM
Last Post: bateyy

Forum Jump:


Users browsing this thread: 1 Guest(s)