Buy Sell Discuss UK Domain Names at AcornDomains.co.uk

Today's Drop Dates are: 19-02-2012 or 26-02-2012   All times are GMT. The time now is 12:48:30 PM.
Domain Name Sales Domain Software Calculate UK Domain Drop Dates Domain Registration NameDrive Domain Parking Subscribe to our Domains For Sale newsletter
Go Back   Domain Forum Acorn Domains Buy Sell Auction UK Domains > Website Design and Promotion > Website Design > Scripts and Coding
Connect with Facebook

Scripts and Coding PHP, MySQL, scripts

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 16-01-2012, 10:32:16 PM     #1 (permalink)

 
Systreg's Avatar
 
Join Date: Oct 2008
Location: County Cork Republic of Ireland
Posts: 4,181
Systreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond repute

Domain Trader Rating:
(100% / 106)
htaccess help

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:

Quote:
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.
__________________
For Sale sat.co.uk - pda.co.uk
Systreg is online now  
Old 16-01-2012, 10:39:58 PM     #2 (permalink)
mat

 
mat's Avatar
 
Join Date: Apr 2007
Location: Hampshire
Posts: 3,328
mat has a reputation beyond reputemat has a reputation beyond reputemat has a reputation beyond reputemat has a reputation beyond reputemat has a reputation beyond reputemat has a reputation beyond reputemat has a reputation beyond reputemat has a reputation beyond reputemat has a reputation beyond reputemat has a reputation beyond reputemat has a reputation beyond repute

No need to over complicate things. Just whack this code in a .htaccess file for each site. Simples.

Quote:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
__________________
Mathew.co.uk - Follow me on Twitter here
mat is offline  
Old 16-01-2012, 11:02:23 PM     #3 (permalink)

 
Systreg's Avatar
 
Join Date: Oct 2008
Location: County Cork Republic of Ireland
Posts: 4,181
Systreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond repute

Domain Trader Rating:
(100% / 106)
Thanks Mat, I've added that, will now flush dns/clear cache and see what happens.
__________________
For Sale sat.co.uk - pda.co.uk
Systreg is online now  
Old 16-01-2012, 11:07:14 PM     #4 (permalink)

 
Systreg's Avatar
 
Join Date: Oct 2008
Location: County Cork Republic of Ireland
Posts: 4,181
Systreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond repute

Domain Trader Rating:
(100% / 106)
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

That snippet of code you gave, I don't need to add any domain names in to that do I?
__________________
For Sale sat.co.uk - pda.co.uk
Systreg is online now  
Old 17-01-2012, 03:55:55 AM     #5 (permalink)

 
Join Date: Nov 2008
Location: Surrey
Posts: 268
Tricky1 has a reputation beyond reputeTricky1 has a reputation beyond reputeTricky1 has a reputation beyond reputeTricky1 has a reputation beyond reputeTricky1 has a reputation beyond reputeTricky1 has a reputation beyond reputeTricky1 has a reputation beyond reputeTricky1 has a reputation beyond reputeTricky1 has a reputation beyond reputeTricky1 has a reputation beyond reputeTricky1 has a reputation beyond repute

That bit of code is all you need, without the www works for me.
Tricky1 is offline  
Old 17-01-2012, 04:20:24 AM     #6 (permalink)

 
Systreg's Avatar
 
Join Date: Oct 2008
Location: County Cork Republic of Ireland
Posts: 4,181
Systreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond repute

Domain Trader Rating:
(100% / 106)
@ 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?
__________________
For Sale sat.co.uk - pda.co.uk

Last edited by Systreg; 17-01-2012 at 04:22:59 AM.
Systreg is online now  
Old 17-01-2012, 08:27:53 AM     #7 (permalink)

 
redbird's Avatar
 
Join Date: Sep 2005
Location: Worcester
Posts: 898
redbird has a reputation beyond reputeredbird has a reputation beyond reputeredbird has a reputation beyond reputeredbird has a reputation beyond reputeredbird has a reputation beyond reputeredbird has a reputation beyond reputeredbird has a reputation beyond reputeredbird has a reputation beyond reputeredbird has a reputation beyond reputeredbird has a reputation beyond reputeredbird has a reputation beyond repute

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 !
__________________
cdscheap.co.uk (CD price comparison) ~LBE.co.uk ~ meaning of names

Last edited by redbird; 17-01-2012 at 08:31:14 AM.
redbird is online now  
Old 17-01-2012, 02:16:16 PM     #8 (permalink)

 
Systreg's Avatar
 
Join Date: Oct 2008
Location: County Cork Republic of Ireland
Posts: 4,181
Systreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond reputeSystreg has a reputation beyond repute

Domain Trader Rating:
(100% / 106)
Quote:
Originally Posted by redbird View Post
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
__________________
For Sale sat.co.uk - pda.co.uk
Systreg is online now  
Closed Thread



Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Domain Name Community Replies Last Post
Quick htaccess redirect question Rob_F Scripts and Coding 7 12-11-2011 04:21:36 PM
Permanent redirect htaccess? 301? 2001?! fish Scripts and Coding 6 17-03-2011 08:39:12 PM
htaccess guru needed SecNam Website Design 7 13-11-2010 11:40:01 PM
htaccess redirect question... mat Website Design 5 01-07-2010 09:46:57 AM
(help) htaccess WWW purg General Board 2 19-01-2009 10:05:25 PM


All times are GMT. The time now is 12:48:30 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0 RC 2
All content on Acorn Domains is member generated and is not moderated before posting. All content is viewed and used by you at your own risk and AD does not warrant the accuracy or reliability of any of the information. The views expressed are those of the individual contributors and not necessarily those of AD. Please contact us to report any issues or send a PM to "Admin".