Zero Dupe .htaccess ...

Zero duplicate support forum. Personalized HTTP 301 dynamic redirections for phpBB.

Moderator: Moderators

Zero Dupe .htaccess ...

Postby jmueller0823 » Thu Jan 01, 2009 6:32 pm

-- Existing 2.x installation with Mod Rewrite. ~3,000 pages indexed.
-- Upgraded to 3.x
-- Installed SEO Mod Rewrite
-- Installed Zero Dupe

Question

-- The Zero Dupe docs state: "... if previously using mod rewrite
(in phpBB2), keep old .htaccess rewrite rules..."

-- Since the above is true... does that mean we should not use
the rewrite rules generated by phpBB SEO?

Thanks.
Jim
jmueller0823
PR0
PR0
 
Posts: 54
Joined: Sat Dec 27, 2008 2:50 am

Advertisement

Postby HB » Thu Jan 01, 2009 11:02 pm

It means you need both for a little while since you want "old" urls to be redirected. When in doubt, check:

http://web-sniffer.net/

This tool will tell you the return code and content. Verify that your old URLs are redirected (301 Permanently Moved) instead of treated as missing (404 Not Found).
Dan Kehn
HB
phpBB SEO Team
phpBB SEO Team
 
Posts: 1561
Joined: Mon Oct 16, 2006 2:25 am

Postby SeO » Sun Jan 04, 2009 2:40 pm

Converting is a good occasion to start using our SEO premod as well ;)

Anyway yes, as it is told, you need to keep the old rewriterules (phpBB2.x) at the end of your new phpBB3 .htaccess up and running (eg with proper path and slashes like you once did for phpBB2).

This way, the old rewriterules will allow the old urls to be handled by the zero duplicate in phpBB's scripts and to properly be redirected to the new ones.

If you did not convert yet, take the time to test the SEO premod, it's important to understand the new features a bit to make wises choices for your future urls.
In all cases the most important is that the massive redirect should be final, hesitating with the new urls is not very good. Done well, this is totally transparent to search engines.

If yo have doubts, post here both your old and new .htaccess ;)
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby jmueller0823 » Sun Jan 04, 2009 11:14 pm

Thanks for the assist.

If you would, please take a quick look at these.
Thanks!

New, phpBB3 .htaccess
Code: Select all
RewriteEngine On
RewriteBase /

# WWW REDIRECT
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]

# FORUMS PAGES
# FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX
# RewriteRule ^boards/forum\.html$ /boards/index.php [QSA,L,NC]
# FORUM
RewriteRule ^boards/[a-z0-9_-]*-f([0-9]+)(-([0-9]+))?\.html$ /boards/viewforum.php?f=$1&start=$3 [QSA,L,NC]
# TOPIC WITH VIRTUAL FOLDER
RewriteRule ^boards/[a-z0-9_-]*-f([0-9]+)/topic([0-9]+)(-([0-9]+))?\.html$ /boards/viewtopic.php?f=$1&t=$2&start=$4 [QSA,L,NC]
# GLOBAL ANNOUNCES WITH VIRTUAL FOLDER
RewriteRule ^boards/announces/topic([0-9]+)(-([0-9]+))?\.html$ /boards/viewtopic.php?t=$1&start=$3 [QSA,L,NC]
# TOPIC WITHOUT FORUM ID & DELIM
RewriteRule ^boards/([a-z0-9_-]*)/?topic([0-9]+)(-([0-9]+))?\.html$ /boards/viewtopic.php?forum_uri=$1&t=$2&start=$4 [QSA,L,NC]
# PROFILES SIMPLE
RewriteRule ^boards/member([0-9]+)\.html$ /boards/memberlist.php?mode=viewprofile&u=$1 [QSA,L,NC]
# USER MESSAGES SIMPLE
RewriteRule ^boards/member([0-9]+)-(topics|posts)(-([0-9]+))?\.html$ /boards/search.php?author_id=$1&sr=$2&start=$4 [QSA,L,NC]
# GROUPS SIMPLE
RewriteRule ^boards/group([0-9]+)(-([0-9]+))?\.html$ /boards/memberlist.php?mode=group&g=$1&start=$3 [QSA,L,NC]
# POST
RewriteRule ^boards/post([0-9]+)\.html$ /boards/viewtopic.php?p=$1 [QSA,L,NC]
# ACTIVE TOPICS
RewriteRule ^boards/active-topics(-([0-9]+))?\.html$ /boards/search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
# UNANSWERED TOPICS
RewriteRule ^boards/unanswered(-([0-9]+))?\.html$ /boards/search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
# NEW POSTS
RewriteRule ^boards/newposts(-([0-9]+))?\.html$ /boards/search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]
# THE TEAM
RewriteRule ^boards/the-team\.html$ /boards/memberlist.php?mode=leaders [QSA,L,NC]
# FORUM WITHOUT ID & DELIM
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^boards/([a-z0-9_-]+)(-([0-9]+))\.html$ /boards/viewforum.php?forum_uri=$1&start=$3 [QSA,L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^boards/([a-z0-9_-]+)\.html$ /boards/viewforum.php?forum_uri=$1 [QSA,L,NC]

# old phpBB2 code begin here................................................
RewriteRule !\.html$ - [L]
RewriteRule ^boards/[a-z0-9-]+-([pt])([0-9]+)\.html$ /boards/viewtopic.php?$1=$2 [L]
RewriteRule ^boards/[a-z0-9-]+-f([0-9]+)\.html$ /boards/viewforum.php?f=$1 [L]
RewriteRule ^boards/[a-z0-9-]+-c([0-9]+)\.html$ /boards/index.php?c=$1 [L]
RewriteRule ^boards/[a-z0-9-]+-u([0-9]+)\.html$ /boards/profile.php?mode=viewprofile&u=$1 [L]
RewriteRule ^boards/([a-zA-Z0-9_]+),([^/,]+),([^/,]*)([^/]*\.html)$ boards/$1$4?$2=$3 [QSA,N]
RewriteRule ^boards/[a-z0-9-]+-([pt])([0-9]+),([^/,]+),([^/,]*)([^/]*\.html)$ boards/viewtopic$5?$1=$2&$3=$4 [QSA,N]
RewriteRule ^boards/[a-z0-9-]+-f([0-9]+),([^/,]+),([^/,]*)([^/]*\.html)$ boards/viewforum$4?f=$1&$2=$3 [QSA,N]
RewriteRule ^boards/([a-zA-Z0-9_]+)\.html$ /boards/$1.php [L]



Also... Earlier in this thread, and in the docs, the importance
of testing with web-sniffer.net is stressed...

My test results were:


For a valid URL
HTTP Response Header = HTTP Status Code: HTTP/1.1 200 OK

For an invalid URL
HTTP Response Header = HTTP Status Code: HTTP/1.1 404 Not Found


I think I'm missing something here...?
Help please. Thanks.
jmueller0823
PR0
PR0
 
Posts: 54
Joined: Sat Dec 27, 2008 2:50 am

Postby SeO » Mon Jan 05, 2009 10:00 am

Well, there are some genuine 404, what url did you test ?

Only the phpBB2 urls will be redirected, have you tried one ?
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby jmueller0823 » Mon Jan 05, 2009 3:34 pm

mysite = growth trac dot com

The following are Google-indexed, phpBB2 URLs

-http://wwww.mysite.com/boards/affair-leading-to-adulterous-2nd-marriage-help-t1648.html
-http://ww.mysite.com/boards/im-planning-a-mother-daughter-banquet-creativity-needed-t576.html
-http://www.mysite.com/boards/reseparation-will-make-us-stronger-t1380.html
-http://www.mysite.com/boards/viewtopic,p,6212.html

-- All of the above URLs produce 404 errors. They should redirect?


The URL below, was just Google-indexed on our
new phpBB3 mixed SEO boards

-http://www.mysite.com/boards/viewtopic.php?p=6573992

-- Does the above look like a "proper" URL?

Thanks again.
Jim
jmueller0823
PR0
PR0
 
Posts: 54
Joined: Sat Dec 27, 2008 2:50 am

Postby SeO » Tue Jan 06, 2009 12:07 pm

Well, this rewriterule should handle the old topic urls :
Code: Select all
RewriteRule ^boards/[a-z0-9-]+-([pt])([0-9]+)\.html$ /boards/viewtopic.php?$1=$2 [L]


I'd rather use :
Code: Select all
RewriteRule ^boards/[a-z0-9-]+-(p|t)([0-9]+)\.html$ /boards/viewtopic.php?$1=$2 [QSA,L,NC]


But if it was previously working in the boards/ dir, and if of course the phpBB3 url do work (with same path and slashes), there are no reasons why it would not work.

Thes rewriterules seems pretty wierdly done to mee too :
Code: Select all
RewriteRule ^boards/([a-zA-Z0-9_]+),([^/,]+),([^/,]*)([^/]*\.html)$ boards/$1$4?$2=$3 [QSA,N]
RewriteRule ^boards/[a-z0-9-]+-([pt])([0-9]+),([^/,]+),([^/,]*)([^/]*\.html)$ boards/viewtopic$5?$1=$2&$3=$4 [QSA,N]
RewriteRule ^boards/[a-z0-9-]+-f([0-9]+),([^/,]+),([^/,]*)([^/]*\.html)$ boards/viewforum$4?f=$1&$2=$3 [QSA,N]


The N flag is not of the kind to use without caution, and I don't find the obvious reason why it would be needed here.
I as well find it a bit strange to see that the viewtopic and viewforum suffixes are set through mod_rewrite, it's not like the script suffix was going to change!

So it would probably be better to run simpler and more focused rewriterules here, but we would need to know every type of url to handle before. On the other hand, if these worked, there is no real reason why they would not now.

You could try this instead, which should do the same job in case you have trouble :
Code: Select all
RewriteRule ^boards/[a-z0-9_-]+-(p|t)([0-9]+),([^/,]+),([^/,]*)[^/]*\.html$ boards/viewtopic.php?$1=$2&$3=$4 [QSA,L,NC]
RewriteRule ^boards/[a-z0-9_-]+-f([0-9]+),([^/,]+),([^/,]*)[^/]*\.html$ boards/viewforum.php?f=$1&$2=$3 [QSA,L,NC]
RewriteRule ^boards/([a-z0-9_]+),([^/,]+),([^/,]*)[^/]*\.html$ boards/$1.php?$2=$3 [QSA,L,NC]


Now if -http://www.mysite.com/boards/viewtopic.php?p=6573992 was indexed and is not currently redirected, make sure you installed / activated the zero dupe with the post redirection option at least set to "guests".
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby jmueller0823 » Tue Jan 06, 2009 4:20 pm

Thank you.

Yes, the "old" rewrite rules did work, so I'll leave those in place.

At some point should I remove these old rules?


We just moved our forums to a sub-domain.

Previously located at: www.mysite/boards

Now located at: forums.mysite.com

Does this impact the rewrite rules or robots.txt ?

Thanks again-- you've been a big help.

Jim
jmueller0823
PR0
PR0
 
Posts: 54
Joined: Sat Dec 27, 2008 2:50 am


Return to Zero duplicate

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 4 guests