Locking the www in urls

Discussions about SEO Techniques implemented in your sites. Tests, Studies and results analysis.

Moderator: Moderators

Postby dcz » Fri Sep 08, 2006 7:38 am

amir abbas wrote:hello

my domain is on new server
both

http://persia-cms.com
and
http://www.persia-cms.com

works for my domain
how can i lock www in my first domain and all subdomain
i have subdomain in this address

http://forum.persia-cms.com

:?


Very simple, if as I think the forum sub-domain is located in a separate folder (can be inside though) than the main domain's root.

If so, you'll just need to use the suggested rewriterules, the negative one :

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


to you main domain's .htaccess.

This will make sure http://www.persia-cms.com is the only used domain for the main one.

Then, for your sub-domain's .htaccess, same thing as www.forum.persia-cms.com and forum.persia-cms.com are working, you have top choose one of the two and lock it.

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


to keep www prefix or :

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


To get rid of it.

;)


++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Advertisement

Postby AmirAbbas » Fri Sep 08, 2006 7:58 am

:D

thanks

i add this one to my root .htaacess file

Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.persia-cms\.com$ [NC]
RewriteRule ^(.*) http://www.persia-cms.com/$1 [QSA,L,R=301]


and this one to my forum subdomain

Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.forum\.persia-cms\.com$ [NC]
RewriteRule ^(.*) http://www.forum.persia-cms.com/$1 [QSA,L,R=301]


both of them working perfect :wink:
but another question

a have near 850 link to my -http://forum.persia-cms.com
what will happen for this link ?

what can i do ?
i must change all of them ?!

and which one is better
having WWW for subdomain
or get rid of www for subdomain
Last edited by AmirAbbas on Fri Sep 08, 2006 8:34 am, edited 1 time in total.
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby lavinya » Fri Sep 08, 2006 8:13 am

thanks for knowledges and reply... :D ok.

dcz wrote:
There would be some more small optimizations doable in your .htaccess, we can look at it in the Apache mod rewrite forum if you like.

++


dcz if you my .htaccess make small optimizations I Will be very happy :)

current my .htaccess ( http://www.lavinya.net/ .htaccess )
Code: Select all
AddType application/x-httpd-php .html .htm

ErrorDocument 404 /404.html
ErrorDocument 403 /403.html

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

RewriteEngine On
RewriteRule ^phpBB2/post-([0-9]*)\.html phpBB2/viewtopic.php?p=$1 [QSA,L,NC]
RewriteRule ^phpBB2/view-poll([0-9]*)-([0-9]*)-([a-zA-Z]*).* phpBB2/viewtopic.php?t=$1&postdays=$2&postorder=$3&vote=viewresult [L,NC]
RewriteRule ^phpBB2/about([0-9]*).html&highlight=([a-zA-Z0-9]*) phpBB2/viewtopic.php?t=$1&highlight=$2 [L,NC]
RewriteRule ^phpBB2/about([0-9]*).html&view=newest phpBB2/viewtopic.php?t=$1&view=newest [L,NC]
RewriteRule ^phpBB2/about([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* phpBB2/viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4 [L,NC]
RewriteRule ^phpBB2/about([0-9]*)-([0-9]*).* phpBB2/viewtopic.php?t=$1&start=$2 [L,NC]
RewriteRule ^phpBB2/about([0-9]*).* phpBB2/viewtopic.php?t=$1 [L,NC]
RewriteRule ^phpBB2/about([0-9]*).html phpBB2/viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5 [L,NC]
RewriteRule ^phpBB2/mark-forum([0-9]*).html* phpBB2/viewforum.php?f=$1&mark=topics [L,NC]
RewriteRule ^phpBB2/updates-topic([0-9]*).html* phpBB2/viewtopic.php?t=$1&watch=topic [L,NC]
RewriteRule ^phpBB2/stop-updates-topic([0-9]*).html* phpBB2/viewtopic.php?t=$1&unwatch=topic [L,NC]
RewriteRule ^phpBB2/forum-([0-9]*).html phpBB2/viewforum.php?f=$1 [L,NC]
RewriteRule ^phpBB2/forum-([0-9]*).* phpBB2/viewforum.php?f=$1 [L,NC]
RewriteRule ^phpBB2/topic-([0-9]*)-([0-9]*)-([0-9]*).* phpBB2/viewforum.php?f=$1&topicdays=$2&start=$3 [L,NC]
RewriteRule ^phpBB2/ptopic([0-9]*).* phpBB2/viewtopic.php?t=$1&view=previous [L,NC]
RewriteRule ^phpBB2/ntopic([0-9]*).* phpBB2/viewtopic.php?t=$1&view=next [L,NC]
RewriteRule ^phpBB2/ara-([0-9]*)-([0-9]*).html phpBB2/search.php?search_id=$1&start=$2 [L]
RewriteRule ^phpBB2/arama-yazar-([a-zA-Z0-9_-]*).html phpBB2/search.php?&search_author=$1 [L]
RewriteRule ^phpBB2/cevapsiz.html phpBB2/search.php?search_id=$1 [L]
RewriteRule ^phpBB2/yeni-kayit.html phpBB2/profile.php?mode=register&agreed=true [L]
RewriteRule ^phpBB2/kayit-coppa.html phpBB2/profile.php?mode=register&agreed=true&coppa=true [L]
RewriteRule ^phpBB2/kayit.html phpBB2/profile.php?&mode=register [L]
RewriteRule ^phpBB2/bilgiduzenle.html phpBB2/profile.php?mode=editprofile [L]
RewriteRule ^phpBB2/uye-([0-9]*).html phpBB2/profile.php?mode=viewprofile&u=$1 [L]
RewriteRule ^phpBB2/kayipsifre.html phpBB2/profile.php?mode=sendpassword [L]
RewriteRule ^phpBB2/kategori-([0-9]*).html phpBB2/index.php\?c=$1 [L]
RewriteRule ^phpBB2/uyelistesi-([a-zA-Z0-9]*)-([a-zA-Z]*)-([0-9]*).html phpBB2/memberlist.php\?mode=$1&order=$2&start=$3 [L]
RewriteRule ^phpBB2/uyelistesi.html phpBB2/memberlist.php [L]
RewriteRule ^phpBB2/sss-([a-zA-Z0-9]*).html phpBB2/faq.php\?mode=$1 [L]
RewriteRule ^phpBB2/sss.html phpBB2/faq.php [L]
RewriteRule ^phpBB2/sitemaps.xml$ phpBB2/sitemap.php [L]
RewriteRule ^phpBB2/sitemap-forum-([0-9]+).xml$ phpBB2/sitemap.php?fid=$1 [L]
RewriteRule ^phpBB2/sitemap-forum.xml$ phpBB2/sitemap.php?forum [L]
RewriteRule ^galeri/lightbox\.htm$ galeri/lightbox.php?%{QUERY_STRING}
RewriteRule ^galeri/lightbox\.([0-9]+)\.htm$ galeri/lightbox.php?page=$1&%{QUERY_STRING}
RewriteRule ^galeri/search\.htm$ galeri/search.php?%{QUERY_STRING}
RewriteRule ^galeri/search\.([0-9]+)\.htm$ galeri/search.php?page=$1&%{QUERY_STRING}
RewriteRule ^galeri/cat\.htm$ galeri/categories.php?%{QUERY_STRING}
RewriteRule ^galeri/cat([0-9]+)\.([0-9]+)\.htm$ galeri/categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
RewriteRule ^galeri/cat([0-9]+)\.htm$ galeri/categories.php?cat_id=$1&%{QUERY_STRING}
RewriteRule ^galeri/img([0-9]+)\.htm$ galeri/details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^galeri/img([0-9]+)\.([a-zA-Z0-9]+)\.htm$ galeri/details.php?image_id=$1&mode=$2&%{QUERY_STRING}
RewriteRule ^galeri/postcard([a-zA-Z0-9]+)\.htm$ galeri/postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^galeri/postcard\.img([0-9]+)\.htm$ galeri/postcards.php?image_id=$1&%{QUERY_STRING}
User avatar
lavinya
PR1
PR1
 
Posts: 167
Joined: Mon Jul 24, 2006 9:05 am
Location: Turkey

Postby dcz » Fri Sep 08, 2006 8:57 am

dcz wrote:
There would be some more small optimizations doable in your .htaccess, we can look at it in the Apache mod rewrite forum if you like.

++


Let's avoid off topic, I forgot to mention the link : Apache mod rewrite forum

;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby lavinya » Fri Sep 08, 2006 8:58 am

ok dcz thanks. :)
User avatar
lavinya
PR1
PR1
 
Posts: 167
Joined: Mon Jul 24, 2006 9:05 am
Location: Turkey

Postby lavinya » Sat Sep 09, 2006 8:24 am

dcz I have big problem :(

my problem is this system is showing doesnt lacking pages.

for example: there is no addresses like www. lavinya.net/phpbb2/about1594.html
or about159SDFSD4.html etc.... ...

but it is showing :(

my file is "phpBB2" (not bb, it must be BB)

and not exiting subdomain (eg dcz. lavinya.org) but redirect to main page ?
but it must not show.
this is spam I think.

:cry:

please help me :(
User avatar
lavinya
PR1
PR1
 
Posts: 167
Joined: Mon Jul 24, 2006 9:05 am
Location: Turkey

Postby dcz » Sat Sep 09, 2006 3:29 pm

lavinya wrote:dcz I have big problem :(

my problem is this system is showing doesn't lacking pages.

for example: there is no addresses like -www.lavinya.net/phpbb2/about1594.html


Well this could be fixed with something like :
Code: Select all
RewriteRule  ^phpbb2/(.*) /phpBB2/$1 [R=301,L]

Just after the www rewriterule.
You may need to get rid of the L flag : [R=301,L] => [R=301]

lavinya wrote:or about159SDFSD4.html etc.... ...


This is due to the able2know rewriterules, they are not strict enough and accept characters and digits where they should only accept digits.
Then, some intval(159SDFSD4) must end up being an integer, with luck being a real topic id.

This is just impossible with the phpBB SEO rewriterules, and is a duplicate source, especially if you run Google AdSense, as Google is as well grabbing URLs to spider from there, so the link only need to be used once to exist for Google.

lavinya wrote:this is spam I think.


This is very possible someone started posting links like this, but could as well only be a user testing you mod rewrite and the Google AdSense to have grabbed it.

lavinya wrote:and not exiting subdomain (eg dcz. lavinya.org) but redirect to main page ?


I am sorry I am to unsure about what you're saying here to answer. Could you elaborate a bit on this ?

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby AmirAbbas » Fri Nov 03, 2006 5:15 am

hi again

i learnt how can i lock www in subdomain
i want to lock www in this URL

-http://aerospacetalk.com/forum/

how can i do it ?
thanks in advance :wink:
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby dcz » Fri Nov 03, 2006 11:06 am

Well, it should be rather straighforward, something like :

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


in the domain's root (eg one level above forum/)

With off course the same small turnarounds as always, you may need to play a bit with syntax before it will fully work.


++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby AmirAbbas » Fri Nov 03, 2006 1:10 pm

its not clear for me
now the www is fixed in main domain
i mean -http://aerospacetalk.com will redirect to -http://www.aerospacetalk.com

i have problem with -http://aerospacetalk.com/forum/
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby dcz » Sat Nov 04, 2006 8:39 am

Do you have more than one .htaccess with rewriterules ?

The principle would be here to only use one at the root level. Please post your .htaccess in case you have troubles ;)

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby AmirAbbas » Mon Nov 06, 2006 3:45 am

dcz wrote:Do you have more than one .htaccess with rewriterules ?


you're right :mrgreen:

i had two .htaccess file :)
i removed one of them
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby AmirAbbas » Wed Dec 13, 2006 4:43 pm

one of my friend asked me " how can i lock www in url in windows IIS server ?"

is it possible ? :roll:
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby AmirAbbas » Thu Dec 14, 2006 12:57 pm

bump :D
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby dcz » Thu Dec 14, 2006 1:09 pm

bimp :D

Well, I am currently working on it with a french phpBB SEO member. We are looking for a php solution.

It should be doable using isapi_rewrite, I'll see how, but I do not have any IIS installation to work with so ...

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

PreviousNext

Return to SEO Techniques

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 2 guests