How do I force the "WWW" version of my website using the .htaccess file?

Category: Domain Names

Garet
Asked:
2011-12-18 7:08 am EST

Hits: 7,951
I changed my index.html to a completely different file and when i type www.topdfconverters.com in it actually goes to my site but when i just type topdfconverters.com in my browser it gives me that page i got when i signed up.

You must login before you can ask a follow up question.

You must login before you can submit an answer.

Best answer chosen by InMotion Hosting staff

0

Tim S.
Staff
9,967 Points
2011-12-19 10:11 am EST
Hi Garet,

Thanks for posting your question. I'm more than happy to assist you. It appears you have already resolved the issue on your own. When I visit both URLs you have provided they display the same content.

It appears now you are forcing WWW when you go to the toppdfconverters.com and redirecting it. Also, many times issues like this can be corrected by first attempting to clear your browser cache.

Anytime you wish to force all your visitors to the "www" version of your website, this can be accomplished by using your .htaccess file. Here is the code snippet to add to your .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.your_domain.com$
RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301]


If you need further assistance, please feel free to contact us.

Thank you!

Tim S

You must login before you can post a comment about this answer.

Like this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!