Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

htaccess help

Status
Not open for further replies.

Systreg

Staff member
Joined
Oct 13, 2008
Posts
8,114
Reaction score
666
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.
 
No need to over complicate things. Just whack this code in a .htaccess file for each site. Simples.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
 
@ 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:
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom