PDA

View Full Version : domain.com and www.domain.com


thebookiesoffers
3rd October 2009, 19:58
how do i sort it so thebookiesoffers.co.uk redirects to www.thebookiesoffers.co.uk (http://www.thebookiesoffers.co.uk) using the 301 redirect? I'll need it explained in basic laymans terms aswell please as im a bit of a thicko when it comes to stuff like this:D

cheers in advance

david64
3rd October 2009, 20:15
FTP/SFTP into your server. Look for a file called .htaccess in the root of your site. If there isn't one create one and paste this in:


RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} !^localhost$
RewriteRule ^.*$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,QSA,L]


If you already have one only past in the last 3 lines unless yo don't have the rewriteengine line in there.

That will to to http://www. redirects for any site.

If it doesn't work you will need to get one specifically to look at it because there may need to be things that need to be set up.

thebookiesoffers
3rd October 2009, 22:16
FTP/SFTP into your server. Look for a file called .htaccess in the root of your site. If there isn't one create one and paste this in:


RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} !^localhost$
RewriteRule ^.*$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,QSA,L]


If you already have one only past in the last 3 lines unless yo don't have the rewriteengine line in there.

That will to to http://www. redirects for any site.

If it doesn't work you will need to get one specifically to look at it because there may need to be things that need to be set up.

just tried making a new file in my root (im using dreamweaver) and it said invalid file extension when i tried to open it to edit it. where have i gone wrong

p.s, told you im a thicko with this stuff:D

david64
3rd October 2009, 22:39
just tried making a new file in my root (im using dreamweaver) and it said invalid file extension when i tried to open it to edit it. where have i gone wrong

p.s, told you im a thicko with this stuff:D

Sounds to me like Dreamweaver doesn't allow you to create this file. Try using Notepad. Can't really give advice beyond that since I don't use Windows.

thebookiesoffers
3rd October 2009, 23:14
Sounds to me like Dreamweaver doesn't allow you to create this file. Try using Notepad. Can't really give advice beyond that since I don't use Windows.

without sounding like an arse can you just put the actaul code up that will redirect thebookiesoffers.co.uk to www.thebookiesoffers.co.uk (http://www.thebookiesoffers.co.uk) please mate so i can copy and paste? I have now fixed it so the file works:)

consultant
4th October 2009, 09:06
why redirect?

Dependant on your server/setup, tapping in one or other should get yu to the same place!

thebookiesoffers
4th October 2009, 10:17
why redirect?

Dependant on your server/setup, tapping in one or other should get yu to the same place!

so google doesn't think they are 2 different pages

Delicious Webdesign
4th October 2009, 10:49
FTP/SFTP into your server. Look for a file called .htaccess in the root of your site. If there isn't one create one and paste this in:


RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} !^localhost$
RewriteRule ^.*$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,QSA,L]
If you already have one only past in the last 3 lines unless yo don't have the rewriteengine line in there.

That will to to http://www. redirects for any site.

If it doesn't work you will need to get one specifically to look at it because there may need to be things that need to be set up.

This is assuming that they are running linux or unix on an Apache Webserver and if they are running windows on IIS then this advice is not going to help much.

FelixSilver
4th October 2009, 10:50
without sounding like an arse can you just put the actaul code up that will redirect thebookiesoffers.co.uk to www.thebookiesoffers.co.uk (http://www.thebookiesoffers.co.uk) please mate so i can copy and paste? I have now fixed it so the file works:)

Try this (if your site is hosted on Apache):

RewriteEngine On
RewriteCond %{HTTP_HOST} ^thebookiesoffers.co.uk [NC]
RewriteRule ^(.*)$ http://www.thebookiesoffers.co.uk/$1 [L,R=301]

WeblinkPlus
4th October 2009, 11:28
just tried making a new file in my root (im using dreamweaver) and it said invalid file extension when i tried to open it to edit it. where have i gone wrong

p.s, told you im a thicko with this stuff:D

In windows, it is htaccess without the period, assuming you are using apache of course...

gogul2k
4th October 2009, 12:12
so google doesn't think they are 2 different pages
It wont make a difference to Google. Unless there's some odd DNS configuration then all pages are treated the same regardless of whether the page starts with http:// or www ;)