• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

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,316
Reaction score
811
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