phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
Locking the www in urls
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » SEO Techniques
::  
Author Message
sportman1280
phpBB SEO Team
phpBB SEO Team


Joined: 29 Nov 2006
Posts: 281

Locking the www in urlsPosted: Mon Dec 18, 2006 3:35 am    Post subject: Re: Locking the www in urls

Code:
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*) http://www.example.com/$1 [QSA,L,R=301]


works great! thanks Very Happy
Back to top
Visit poster's website
arch stanton
PR1
PR1


Joined: 04 Oct 2006
Posts: 117

Locking the www in urlsPosted: Tue Jan 09, 2007 1:30 am    Post subject: Re: Locking the www in urls

Hi dcz, as you know from another thread, I have had problems with 302 redirects from an old domain making Google think it is seeing duplicate content.

I have made example.org.uk an alias of example.co.uk as you recommended.

To get rid of the dupes for example.co.uk, I have added the following to my .htaccess:

Code:
RewriteCond %{HTTP_HOST} ^example\.co.uk$ [NC]
RewriteRule ^(.*) http://www.example.co.uk/$1 [QSA,L,R=301]


This seems to work fine. And to get rid of example.org.uk, I have added the following:

Code:
RewriteCond %{HTTP_HOST} ^example\.org.uk$ [NC]
RewriteRule ^(.*) http://www.example.co.uk/$1 [QSA,L,R=301]


But of course this doesn't work for www.example.org.uk. What code do I need to stop these dupes?
:
:
:
:
Edit: I have just added the following code:
Code:
RewriteCond %{HTTP_HOST} ^www.example\.org.uk$ [NC]
RewriteRule ^(.*) http://www.example.co.uk/$1 [QSA,L,R=301]


This does appear to work. Will Google now treat them as 301 redirects?
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14403

Locking the www in urlsPosted: Tue Jan 09, 2007 11:31 am    Post subject: Re: Locking the www in urls

I suggest to use only this :

Code:
RewriteCond %{HTTP_HOST} !^www.example\.co\.uk$ [NC]
RewriteRule ^(.*) http://www.example.co.uk/$1 [QSA,L,R=301]


So that anything leading to where the -www.example.co.uk domain is installed will be redirected to -http://www.example.co.uk/

Thus example.co.uk and example.org.uk and -wwwexample.org.uk.

And the redirection are HTTP 301, it's easy to check Wink

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
arch stanton
PR1
PR1


Joined: 04 Oct 2006
Posts: 117

Locking the www in urlsPosted: Tue Jan 09, 2007 12:27 pm    Post subject: Re: Locking the www in urls

dcz, remember example1 and example2 are slightly different spellings. So won't I need two separate bits of code anyway?
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14403

Locking the www in urlsPosted: Tue Jan 09, 2007 12:52 pm    Post subject: Re: Locking the www in urls

Nope, anything being different than -www.example.co.uk will be redirected, thus whatever.com too if it's linked to this folder Wink

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
jolin



Joined: 04 May 2006
Posts: 17

Locking the www in urlsPosted: Thu Jan 18, 2007 12:33 am    Post subject: Multiple domains www. redirection

I have a problem. I have a few domains configured on my apache so I can't use a particular domain in the .htaccess rewrite rule!

How do I write the following code to grab the domain name or to just redirect any .domain to www.domain.com

Code:
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*) http://www.example.com/$1 [QSA,L,R=301]


(All of these domains point to the same index file and are not seperated into folders so I can't set individual .htaccess files to each domain)

My apache configuration does not allow me to do the header location redirect for some reason, it just don't do any php header location redirect for some reson? so I can't use this method also.

_________________
Gammonish.com - Backgammon Game Resource.


Last edited by jolin on Tue May 15, 2007 4:25 pm; edited 1 time in total
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14403

Locking the www in urlsPosted: Thu Jan 18, 2007 1:28 am    Post subject: Re: Locking the www in urls

What do you want to do ?

Redirect many domains to one or redirect the www prefix for several domains on the same host ?

To redirect all to one, use :
Code:

RewriteCond %{HTTP_HOST} !^www.example\.com$ [NC]
RewriteRule ^(.*) http://www.example.com/$1 [QSA,L,R=301]


To redirect each one individually, use :

Code:
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*) http://www.example.com/$1 [QSA,L,R=301]


For each one of them in the roots .htacces Wink

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
jolin



Joined: 04 May 2006
Posts: 17

Locking the www in urlsPosted: Thu Jan 18, 2007 1:59 am    Post subject: Re: Locking the www in urls

dcz wrote:
What do you want to do ?

Redirect many domains to one or redirect the www prefix for several domains on the same host ?

++


No No, what I mean is I have like 250 domains on this server and I wont write an individual rewrite rule in the .htaccess for each of them.

I want to redirect .any-domain.any-suffix to www.any-domain.any-suffix (add the www. prefix if non exist)

As I have around 250 domains I can't put a particular domain name in the .htaccess page but rather I need it to fetch it from the address or just say redirect .any-domain.any.suffix to www.any-domain.any.suffix

Could that be done in .htaccess?

(Your doing an unbelieveible work on this site Wink )

_________________
Gammonish.com - Backgammon Game Resource.


Last edited by jolin on Tue May 15, 2007 4:26 pm; edited 1 time in total
Back to top
Visit poster's website
esiason14



Joined: 31 Jan 2007
Posts: 3

Locking the www in urlsPosted: Thu Feb 01, 2007 3:52 am    Post subject: Re: Locking the www in urls

Hi, I'm getting ready to try to install this and I want to make sure my htaccess is correct.

My CURRENT htaccess looks like this:

Code:
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteRule ^players.php/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/$ /players.php?$1=$2&$3=$4&$5=$6&$7=$8 [L]
RewriteRule ^players.php/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/$ /players.php?$1=$2&$3=$4&$5=$6&$7=$8&$9=$10 [L]
RewriteRule ^historical_fantasy_pts/year/([^.]+)/position/([^.]+)$ historical_fantasy_pts.php?year=$1&position=$2 [L]
RewriteRule ^historical_fantasy_pts/year/([^.]+)/position/([^.]+)week/([^.]+)/$ historical_fantasy_pts.php?year=$1&position=$2&week=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php


So I add the new rules to the end.?? It is in the subfolder phpBB2, so how would I make those changes and then add it. Thanks!!
Back to top
arch stanton
PR1
PR1


Joined: 04 Oct 2006
Posts: 117

Locking the www in urlsPosted: Thu Feb 01, 2007 6:55 am    Post subject: Re: Locking the www in urls

dcz, I'm still getting supplemental results on most URLs since locking the WWW. As I installed this mod on January 10 (and already had zero dupe), should all the supplementals be gone by February 10?
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14403

Locking the www in urlsPosted: Thu Feb 01, 2007 10:31 am    Post subject: Re: Locking the www in urls

@ esiason14

Just implement the Redirection as your very first one.

Because there is no need to have a RewriteRule match if we are going to redirect it after because of the www prefix, this need to be the very first thing checked.

In your case, would be after :

Code:
Options +FollowSymlinks -MultiViews
RewriteEngine on


You'll just have to make sure it is working before you're done with it.

@ arch stanton
Well, supplemental result is not omitted results, Google said it was kind of a second index to put some types of websites in it.
They claim there is the same probability to show up in SERPs, in both indexes, even though it looks like the supplemental index won't be as good as the main one, but.

Anyway, this has nothing to deal with this redirection, just make sure what you've installed is properly working and work on content and backlinks Wink

I'm not sure you' be PR8 by feb 10 though Laughing

When talking about indexing and search engine, could you in the future use more appropriate threads ?

Thx.

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
hvactechforum



Joined: 03 Mar 2007
Posts: 44

Locking the www in urlsPosted: Sat Apr 07, 2007 12:25 pm    Post subject: Re: Locking the www in urls

I added the following code to my .htaccess file:
Code:
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*) http://www.example.com/$1 [QSA,L,R=301]


Then I cleared all cookies and checked with a new browser, when I typed "hvacruniverse.com" into the address bar I was taken to "http://hvacruniverse.com". Should not I have been taken to "http://www.hvacruniverse.com"? Am I doing something wrong?
Back to top
falkra
PR1
PR1


Joined: 11 Mar 2007
Posts: 168

Locking the www in urlsPosted: Sat Apr 07, 2007 10:29 pm    Post subject: Re: Locking the www in urls

Hello, it may sound stupid, but if you really added the code you quoted with no modification, it cannot work, you have to replace "example" by "hvacruniverse". Confused
Sorry if you already did. Wink
Back to top
Visit poster's website
hvactechforum



Joined: 03 Mar 2007
Posts: 44

Locking the www in urlsPosted: Sat Apr 07, 2007 10:57 pm    Post subject: Re: Locking the www in urls

falkra wrote:
Hello, it may sound stupid, but if you really added the code you quoted with no modification, it cannot work, you have to replace "example" by "hvacruniverse". Confused
Sorry if you already did. Wink


Yahhh...that might quite possibly be the dumbest thing I have ever done. Let me think.........yup, dumbest thing ever! Thanks falkra! After about 483 hours of code, you start to slip up a little... Embarassed Rolling Eyes Shocked

It's working now!
Back to top
noworyz
PR0
PR0


Joined: 08 Jan 2007
Posts: 87

Locking the www in urlsPosted: Sun Apr 15, 2007 6:06 pm    Post subject: Re: Locking the www in urls

ok, I have this in my .htaccess

Code:
Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^bigskyfans\.com$ [NC]
RewriteRule ^(.*) http://www.bigskyfans.com/$1 [QSA,L,R=301]


and it redirects fine when putting in bigskyfans.com.

But, if I put bigskyfans.com/gallery it redirect to www.bigskyfans.comgallery thus not working. What am I missing to have the / after the .com?

Thanks
Back to top
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » SEO Techniques
Page 5 of 7 Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next

Navigation Similar Topics

Jump to: