Locking the www in urls

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

Moderator: Moderators

Postby Professional » Tue Apr 29, 2008 6:09 am

is it work with phpbb 3.0.1 ?
my htaccess code now is:
Code: Select all
RewriteEngine on

RewriteCond %{HTTP_HOST} ^mobile4persian.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mobile4persian.com$
RewriteRule ^/?$ http://www.mobile4persian.com/forum/ [R=301,L]

RewriteCond %{HTTP_HOST} ^m4pshop.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.m4pshop.net$
RewriteRule ^/?$ http://www.m4shop.net/commerce [R=301,L]


but it open with and without www
my site:http://mobile4persian.com
User avatar
Professional
PR5
PR5
 
Posts: 543
Joined: Mon Apr 07, 2008 5:41 am
Location: 1/2 of the World

Advertisement

Postby SeO » Tue Apr 29, 2008 8:27 am

m4pshop.net does not seems to be online.

So, if you have an .htaccess is located in a sub dir, with this .htaccess in the domain's root, you need to implement the www prefix redirection in the forum's .htaccess as well. So far it's working with mobile4persian.com, but not with mobile4persian.com/forum/
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby Professional » Tue Apr 29, 2008 3:44 pm

this .htaccess file is located at root not forum folder.
and my server have 2 domain that m4pshop.net is not used yet.

so can u plz say what shoud be exactly the .htaccess file? :oops:
User avatar
Professional
PR5
PR5
 
Posts: 543
Joined: Mon Apr 07, 2008 5:41 am
Location: 1/2 of the World

Postby SeO » Wed Apr 30, 2008 9:27 am

Professional wrote:this .htaccess file is located at root not forum folder.


I know, that's why you need to implement the www prefix redirection in the one located in the forum dir as well.
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby Professional » Wed Apr 30, 2008 12:57 pm

yes that's right.
but now what shoud i do?
i am confused.
User avatar
Professional
PR5
PR5
 
Posts: 543
Joined: Mon Apr 07, 2008 5:41 am
Location: 1/2 of the World

Postby SeO » Wed Apr 30, 2008 1:37 pm

Add something like :

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


In you forum's .htaccess.

But you may want to install some of our SEO mods for phpBB3, the zero duplicate would perform this redirection by default.
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby Professional » Wed Apr 30, 2008 2:31 pm

ye i know.
but i have a scroll that show the last posts and is very important for me.
i want to know that this system will working after install the seo mods?(that links will change)
i asked my question also here but dear dcz looks so busy:
http://www.phpbb-seo.com/boards/advance ... t2352.html
User avatar
Professional
PR5
PR5
 
Posts: 543
Joined: Mon Apr 07, 2008 5:41 am
Location: 1/2 of the World

Postby SeO » Fri May 02, 2008 12:26 pm

I answered ;)
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby Professional » Sat May 03, 2008 1:20 pm

tnx admin :)
User avatar
Professional
PR5
PR5
 
Posts: 543
Joined: Mon Apr 07, 2008 5:41 am
Location: 1/2 of the World

Postby Professional » Wed Jun 04, 2008 2:30 pm

i finally did it and locked www in url and index like here:

Code: Select all
RewriteEngine on
RewriteCond %{HTTP_HOST} ^forum.mobile4persian.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.forum.mobile4persian.net$
RewriteRule ^(.*)$ http://www.mobile4persian.com/forum/index.php [R=301,L]

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mobile4persian\.com$ [NC]
RewriteRule ^(.*) http://www.mobile4persian.com/$1 [QSA,L,R=301]
RewriteRule ^$ http://www.mobile4persian.com/forum/index.php [QSA,L,R=301]
<Files 403.shtml>
order allow,deny
allow from all
</Files>


now my question is how to link my forum?
for example i want to link mobile to my forum:
-www.mobile4persian.com

or

-www.mobile4persian.com/forum

or

-www.mobile4persiancom/forum/index.php

tnx :D
User avatar
Professional
PR5
PR5
 
Posts: 543
Joined: Mon Apr 07, 2008 5:41 am
Location: 1/2 of the World

Postby SeO » Wed Jun 04, 2008 3:45 pm

These are not good, because you do redirect every request without the www prefix to the forum index, it could as well partly explain your other matter, in case many url where indexed without the www prefix before you did put this up.

Use :

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


It's enough for all cases.

Then, for your index redirection, I do not encourage you do it, there is no real point to install phpBB in a sub directory if you do not want the domain' root to be used. You'd better set up a home page (even basic) for he root directory if you want to keep this structure, you'd start to build PR on it for when you'd want to dev the domain root level a bit in your site.

About linking, example.com/forum/ and example.com/forum/index.php are duplicate, so you'd bnetter choose one or the other and only link to it. Again our mod rewrite with the zero duplicate do take care about this duplicate as well : http://www.phpbb-seo.com/boards/index.php

Keeping this structure, you'd as well need to link the domain root level(www.example.com/).
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby Professional » Fri Jun 06, 2008 11:49 am

tnx i'll test it.
User avatar
Professional
PR5
PR5
 
Posts: 543
Joined: Mon Apr 07, 2008 5:41 am
Location: 1/2 of the World

Postby torgheh » Tue Oct 07, 2008 7:12 pm

Hi admin
I have plesk control panel and it have not the redirect option :(

I have a new cms on a sub folder that named “en”

How can I lock www and index.php for it to have finally this address

-www.toranj-gem.com/en/index.php

i dont want it in subdomain i want it to be like your site

so can u plz say what shoud be the .htaccess file for this problem? :oops:

tnx :)
User avatar
torgheh
 
Posts: 2
Joined: Wed Jan 31, 2007 5:14 am

Postby dcz » Sat Oct 11, 2008 9:45 am

The www prefix redirection is working for all directories in the domain when it is implemented in the domain's root .htaccess and for dirs that do not have a .htaccess using mod_rewrite in them.

In all case, forcing the index is a separate matter.


So in your case, if you do not have a .htaccess in the en/ dir, you'll need to use something like :

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


for the www prefix, and then :
Code: Select all
RewriteRule ^en/?$ /en/index.php [R=301,L]


or :
Code: Select all
RewriteRule ^en/?$ http://www.toranj-gem.com/en/index.php [R=301,L]


to force index.php in the en/ root.

It's pretty similar if you are using a .htaccess in the en/ dir, just need to set path properly, but you'll need to repeat the www prefix redirection it 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

Re: Locking the www in urls

Postby Orbits » Fri Oct 24, 2008 5:24 pm

dcz wrote:I thought it could be wise to start talking a bit about the www in URL.
Second method : URL !=www.example.com.

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



This has always worked for me. But now I'm working to convert my Forum to phpbb3 (premod of course) and this time I'm moving the Forum from the Root to my /forum folder.

I did this on my test server and everything is working. I also moved my .htaccess file to the /forum folder as well just so I can keep it seperate from my primary root .htaccess file.

So, I modified the www redirect and I'm using the following:

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


I'm not very good with ReWrite so I just plopped /forum/ into the original and tadaa!!! Everything worked. If I type in:
http://dogs4sale.net/forum/first-forum

it's redirected to:
http://www.dogs4sale.net/forum/first-fo ... ic-t1.html

Life is good... kinda

Problem
The only issue I have is if I type in:
http://dogs4sale.net/forum

I get a 404. For some reason if I leave out the trailing / on the end of forum it does not redirect to http://www.dogs4sale.net/forum/

Thoughts?

I'm sure this is a SIMPLE fix but I'm still stuck. Plz note - this is all happening on my TEST server so if you try to hit http://www.dogs4sale.net it's still running my original phpbb2 site in the root folder.

Thnx!
Orbits
 
Posts: 45
Joined: Sat Jun 16, 2007 3:57 am

PreviousNext

Return to SEO Techniques

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 2 guests