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  
 
   
rewrite rule clashing - html to php with phpbb-seo rewrite

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » Apache mod Rewrite
::  
Author Message
panexp



Joined: 02 Oct 2006
Posts: 4

rewrite rule clashing - html to php with phpbb-seo rewritePosted: Thu Dec 28, 2006 5:33 pm    Post subject: rewrite rule clashing - html to php with phpbb-seo rewrite

Hello!

I have been using the mixed mod-rewrite without any problems, but I am wanting to run a new rewrite rule for my main site files that rewrites .html to .php in the urls. (in other words, a link to page.html is actually page.php) I have it working just fine, but the rule causes a 404 when you try to view a topic in the forum. I think (??) it is caused by my new rule.

So, how can I write this rule so that it ignores anything in the /forum/ directory? (or am I going about this backwards?)

Here's a snippet of the .htaccess in my site root. My phpbb is located in /forums/:

RewriteEngine On
#add the www always
RewriteCond %{HTTP_HOST} !^www\..* [NC]
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]
#rewrite .html to .php
RewriteRule ^(.*).html$ $1.php

#phpBB SEO Mod addition
RewriteBase /
###########skip the credits......
# FORUM PROTECTION RULE
RewriteRule ^forums/.+/([^/]+\.html)$ /forums/index.php [R=301,L]
# CATEGORIES
RewriteRule ^forums/.+-vc([0-9]+)\.html$ /forums/index.php?c=$1 [QSA,L]
......etc....etc....etc...etc The rest is stock mixed mod_rewrite

So, can I tell my rule to fix everything EXCEPT the /forum/ or is there a better fix?
Back to top
panexp



Joined: 02 Oct 2006
Posts: 4

rewrite rule clashing - html to php with phpbb-seo rewritePosted: Thu Dec 28, 2006 6:40 pm    Post subject: Re: rewrite rule clashing - html to php with phpbb-seo rewrite

Well, I managed to answer my own question! Maybe this will help someone else:

Just add a RewriteCond to the rule:

RewriteCond %{REQUEST_URI} !^.*forums.*$
RewriteRule ^(.*).html$ $1.php

If any knows a better way to do this let me know!!
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 15242

rewrite rule clashing - html to php with phpbb-seo rewritePosted: Thu Dec 28, 2006 11:08 pm    Post subject: Re: rewrite rule clashing - html to php with phpbb-seo rewrite

A simpler and faster way :

Code:
RewriteRule ^([^forums/].+)\.html$ $1.php [L]


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
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » Apache mod Rewrite
Page 1 of 1

Navigation Similar Topics

Jump to: