.htaccess wrong rewrite rules syntax

Discussions and support about the different URL Rewriting techniques for phpBB2.

Moderator: Moderators

.htaccess wrong rewrite rules syntax

Postby jolin » Sun Sep 03, 2006 6:22 pm

Hey dcz,

I have a problem with .htaccess rewrite rules syntax which I suspect is causing the search engines not to cache and index my pages although I setup a Google sitemap and from the user point of view the pagination looks fine.

My hosting provider support team told me my syntax for the .htaccess rewrite rules are not correct and maybe confusing for the search engines.

Something is wrong with the pagination as I use a $ sign which means end of string but I actually have parameters after the .html like:

http://www.domain.com/3-vf4.html?start=100

This is the .htaccess file:


Options +FollowSymlinks
DirectoryIndex portal.php
RewriteEngine On
RewriteBase /

#Make sure the www is present
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteRule ^(.*) http://www.domain.com/$1 [QSA,R=301,L]

# phpBB
RewriteRule ^sitemap_index.xml$ /sitemap.php [L]
RewriteRule ^forum-sitemap-([0-9]+).xml$ /sitemap.php?fid=$1 [L]
RewriteRule ^sitemap-forum.xml$ /sitemap.php?forum [L]


# Linkdb
RewriteRule ^directory.html$ linkdb.php
RewriteRule ^directory-([0-9]+).html$ linkdb.php?action=category&cat_id=$1
RewriteRule ^directory-([0-9]+).html&start=([0-9]+)$ linkdb.php?action=category&cat_id=$1&sort_method=link_time&sort_order=DESC&start=$2


#####################################################
# FORUMS PAGES
#####################################################
# FORUM PROTECTION RULE
RewriteRule ^.+/([^/]+\.html)$ /index.php [R=301,L]
# CATEGORIES
RewriteRule ^.+-vc([0-9]+)\.html$ /index.php?c=$1 [QSA,L]
# PAGINATED FORUM
RewriteRule ^.+-vf([0-9]+)-([0-9]+)\.html$ /viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^.+-vf([0-9]+)\.html$ /viewforum.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^.+-vt([0-9]+)-([0-9]+)\.html$ /viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^.+-vt([0-9]+)\.html$ /viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^.+-vp([0-9]+)\.html$ /viewtopic.php?p=$1 [QSA,L]
RewriteRule [.]*-ac([0-9]*) /album_cat.php?%{QUERY_STRING}&cat_id=$1
RewriteRule [.]*-at([0-9]*) /album_thumbnail.php?%{QUERY_STRING}&pic_id=$1
RewriteRule [.]*-apic([0-9]*) /album_pic.php?%{QUERY_STRING}&pic_id=$1
RewriteRule [.]*-apm([0-9]*) /album_picm.php?%{QUERY_STRING}&pic_id=$1
RewriteRule [.]*-full-asp([0-9]*) /album_showpage.php?full=&pic_id=$1
RewriteRule [.]*-asp([0-9]*) /album_showpage.php?%{QUERY_STRING}&pic_id=$1
RewriteRule [.]*-aper([0-9]*) /album_personal.php?%{QUERY_STRING}&user_id=$1
RewriteRule [.]*-dc([0-9]*) /dload.php?%{QUERY_STRING}action=category&cat_id=$1
RewriteRule [.]*-df([0-9]*) /dload.php?%{QUERY_STRING}action=file&file_id=$1
RewriteRule [.]*-kbc([0-9]*) /kb.php?%{QUERY_STRING}mode=cat&cat=$1
RewriteRule [.]*-kba([0-9]*) /kb.php?%{QUERY_STRING}mode=article&k=$1
RewriteRule [.]*-kbsmp /kb.php?mode=stats&stats=mostpopular
RewriteRule [.]*-kbstr /kb.php?mode=stats&stats=toprated
RewriteRule [.]*-kbsl /kb.php?mode=stats&stats=latest
RewriteRule [.]*-pbc([0-9]*) /kb.php?%{QUERY_STRING}mode=cat&cat=$1
RewriteRule [.]*-pa([0-9]*) /kb.php?%{QUERY_STRING}mode=article&k=$1
RewriteRule [.]*-psmp /kb.php?mode=stats&stats=mostpopular
RewriteRule [.]*-pstr /kb.php?mode=stats&stats=toprated
RewriteRule [.]*-pbsl /kb.php?mode=stats&stats=latest


##############################

Please advise how should I write the pagination rewrite rules syntax correctly ..
Last edited by jolin on Tue May 15, 2007 4:27 pm, edited 1 time in total.
jolin
 
Posts: 17
Joined: Thu May 04, 2006 2:27 pm

Advertisement

Postby dcz » Sun Sep 03, 2006 11:07 pm

Hello Jolin,

Same answer as ever, the webmedic mod rewrite does not do it.
It's just normal to end up with those .html?start=xxwith this mod.

CH went 2.16, so I doubt I'll have time to work on integramod anytime soon, but, I could try to fix the webmedic mod on this, even if the ob_start() method is a bit heavy.

++
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: 21325
Joined: Fri Apr 28, 2006 9:03 pm

Postby jolin » Mon Sep 04, 2006 3:30 pm

Hmmm, I'm not talking about eliminating the parameters after the .html?
although I wish I could fix it, but I'm talking about the syntax of the rewrite rule which seems to be working and generating the desired result meaning the forum pagination with the parameters but as I used your code which was meant to be without parameters I'm confusing the search engines as the syntax is wrong.

# PAGINATED FORUM
RewriteRule ^.+-vf([0-9]+)-([0-9]+)\.html$ /viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^.+-vf([0-9]+)\.html$ /viewforum.php?f=$1 [QSA,L]

The .html$ indicates that this is an end of string ($ sign) and in my case there are parameters after the .html

.html?start=xx

As I said I just took your code as is and didn't change it and it seems to be working but is not written correctly as my string doesn't actually end after the .html and I suspect that this somehow confuses the bots!

My knowledge of writing correct rewrite rules syntax is very poor so I wanted you to look at that code and just help me write it correctly so it would suite a string with parameters after the .html

I really appreciate your help as I'm very frustrated as it all looks fine but something is very wrong and I can't get the bots to index me correctly..
Last edited by jolin on Tue May 15, 2007 4:27 pm, edited 1 time in total.
jolin
 
Posts: 17
Joined: Thu May 04, 2006 2:27 pm

Postby dcz » Mon Sep 04, 2006 3:56 pm

I understand now, it's just because you mixed the phpBB SEO advanced mod rewrite rewriterule with the webmedic's ones.

So the thing is http://www.example.com/3-vf4.html?start=100 is not working ?

If so it may be because the second rewriterule is a bit too strict to work with theses, but I don't really see why.

You can try :

Code: Select all
RewriteRule ^.+-vf([0-9]*) /viewforum.php?f=$1 [QSA,L]


instead of :

Code: Select all
RewriteRule ^.+-vf([0-9]+)\.html$ /viewforum.php?f=$1 [QSA,L]


if this is the problem (do the same for the topic rewriterule if this works).

Otherwise, if those phpBB SEO advanced mod rewrite rewriterules are not used then, just put back webmedic's one and it should 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: 21325
Joined: Fri Apr 28, 2006 9:03 pm

Postby jolin » Mon Sep 04, 2006 7:21 pm

dcz wrote:So the thing is http://www.example.com/3-vf4.html?start=100 is not working ?
++


Well no it's working and resulting:

http://www.example.com/3-vf4.html?start=100

which works and paginate but I just suspect that although it seem to be working in the browser, the search engines read the rewrite rule differently and get confused.

I tried implementing your new code which also seem to work but there is just one thing I don't understand and that is if I need the 2 rewrite rules as I have in my .htaccess or is it redundant.

I have:

Code: Select all
# PAGINATED FORUM
RewriteRule ^.+-vf([0-9]+)-([0-9]+)\.html$ /viewforum.php?f=$1&start=$2 [QSA,L]


and:

Code: Select all
# FORUM
RewriteRule ^.+-vf([0-9]+)\.html$ /viewforum.php?f=$1 [QSA,L]


From what I understand from you I should just have the first one as:

Code: Select all
RewriteRule ^.+-vf([0-9]+)\.html.*([0-9]*)$ /viewforum.php?f=$1&start=$2 [QSA,L]


What I mean is the second parameter for the rewrite rule should be after the .html meaning something like:

whatever-vf(first parameter)\.html?start=(second parameter)$ /viewforum.php?f=$1&start=$2 [QSA,L]

What I don't understand is why:

Code: Select all
# FORUM
RewriteRule ^.+-vf([0-9]+)\.html$ /viewforum.php?f=$1 [QSA,L]


works for me as I don't get with it the second parameter at all for the START value?
Last edited by jolin on Tue May 15, 2007 4:27 pm, edited 1 time in total.
jolin
 
Posts: 17
Joined: Thu May 04, 2006 2:27 pm

Postby dcz » Mon Sep 04, 2006 8:40 pm

you are just missing the mod rewrite basis here.

There are two set of rules for topic and forum because, if I remember well, you managed to partially implement advanced pagination (in the forums, paginated topics), so you need two rules, one for title-vtxx-yy.html and one for title-vtxx.html.

If so you should put back on the original rewriterules your first posted on this thread.


Then, the fact urls ending with .html?start=xx are not spidered well is not very big surprise. That's why I defined another standard for pagination for the phpBB SEO mod rewrites.

Then, you cannot change this playing with .htaccess, you need to install the phpBB SEO mod Rewrites for that.

++
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: 21325
Joined: Fri Apr 28, 2006 9:03 pm


Return to phpBB2 mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 1 guest