Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

htaccess help

Status
Not open for further replies.

DomainPortfolio.ukDomainPortfolio.uk is verified member.

Acorn Moderator
Nominet Member
Nominet Registrar
Joined
Oct 13, 2008
Posts
8,197
Reaction score
726
Hi, can anyone offer some help with a non redirecting problem I have, every time I upload a new html site to HostGator, the site only works without the www. in front of it.

A while back when I had the same problem, someone gave me this to use for an .HTACCESS file for a domain:

Options +FollowSymLinks
RewriteEngine on

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

Does all of that text in the quote go in the HTACCESS file?

I used that on the previous site but it did nothing, if I went to animalwelfare.org.uk, it wouldn't redirect to www.animalwelfare.org.uk, so I removed the HTACCESS file, now it works with either but doesn't redirect from non www. to the www.

The same site I uploaded to HostGator this evening only shows the site at the non www. but not if I go to the www. version.
 
Cleared my cache, ran CCleaner, and then ran ipconfig /flushdns, when I go to animalwelfare.org.uk it still doesn't redirect to www.animalwelfare.org.uk :confused:

That snippet of code you gave, I don't need to add any domain names in to that do I?
 
@ Tricky, do you mean if you paste animalwelfare.org.uk in to your browser, it then redirects and shows the www. before the url?

It doesn't do that for me, unless I'm understanding redirecting incorrectly, I thought that it was supposed to automatically changed the url to www.animalwelfare.org.uk if I went to the site without adding the www., no?
 
Last edited:
Doesn't redirect for me.

In your first example you have a spurious "\" before the org.uk on line 3. Try removing that and delete last two lines

I think you main problem is the .htaccess file NEEDS to be lowercase not .HTACCESS

http://animalwelfare.org.uk/.HTACCESS

Should not display anything !
 
Last edited:
I think you main problem is the .htaccess file NEEDS to be lowercase not .HTACCESS

Thanks mate, using Mats code and changing it to lowercase as suggested, did the trick, the domains now redirect to the www. versions :)
 
Status
Not open for further replies.
Top Bottom