IIS - rewriterules for the advanced mod rewrite

phpBB3 SEO Advanced mod Rewrite support forum.
This mods performs URL rewriting for phpBB, injecting forums and topic titles in their URLs.

Moderator: Moderators

IIS - rewriterules for the advanced mod rewrite

Postby Drew » Sun Aug 31, 2008 5:23 am

I've installed your pre-modded forum here http://www.herbalistsguide.com/forum/index.php This is a new forum and a new install.

The server is 2003 64bit but running in 32bit emulation to accommodate legacy software.
ISAPI_Rewrite has been updated 3.1.0 .56
There are 34 other phpbb forums we host, all working properly
Mysql is 5.0.45

The installation seemed to go fine and the url appears to be re written (http://www.herbalistsguide.com/forum/yo ... -forum-f2/) but I get a 404 error.

After spending several hours in your forum I see that the general diagnosis is rewrite error.

I have tried a number of combinations offered by this forum and by .htaccess in the admin panel. I have tried loading in the forum folder and have tried loading in the root folder. I have tried with virtual root on and with virtual root off.

I am using ISAPI_Rewrite3 and this is my current httpd.ini attempt


Code: Select all
REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
RewriteEngine On
# REWRITE BASE
RewriteBase /
# HERE IS A GOOD PLACE TO ADD THE WWW PREFIXE REDIRECTION

#####################################################
# PHPBB SEO REWRITE RULES - ADVANCED
#####################################################
# AUTHOR : dcz www.phpbb-seo.com
# STARTED : 01/2006
#################################
# FORUMS PAGES
###############
# FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX
# RewriteRule ^forum/forum\.html$ /forum/index.php [QSA,L,NC]
# FORUM
RewriteRule ^forum/[a-z0-9_-]*-f([0-9]+)/?(page([0-9]+)\.html)?$ /forum/viewforum.php?f=$1&start=$3 [QSA,L,NC]
# TOPIC WITH VIRTUAL FOLDER
RewriteRule ^forum/[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /forum/viewtopic.php?f=$1&t=$2&start=$4 [QSA,L,NC]
# GLOBAL ANNOUNCES WITH VIRTUAL FOLDER
RewriteRule ^forum/announces/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /forum/viewtopic.php?t=$1&start=$3 [QSA,L,NC]
# TOPIC WITHOUT FORUM ID & DELIM
RewriteRule ^forum/([a-z0-9_-]*)/?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /forum/viewtopic.php?forum_uri=$1&t=$2&start=$4 [QSA,L,NC]
# PROFILES SIMPLE
RewriteRule ^forum/member([0-9]+)\.html$ /forum/memberlist.php?mode=viewprofile&u=$1 [QSA,L,NC]
# USER MESSAGES SIMPLE
RewriteRule ^forum/member([0-9]+)-(topics|posts)(-([0-9]+))?\.html$ /forum/search.php?author_id=$1&sr=$2&start=$4 [QSA,L,NC]
# GROUPS SIMPLE
RewriteRule ^forum/group([0-9]+)(-([0-9]+))?\.html$ /forum/memberlist.php?mode=group&g=$1&start=$3 [QSA,L,NC]
# POST
RewriteRule ^forum/post([0-9]+)\.html$ /forum/viewtopic.php?p=$1 [QSA,L,NC]
# ACTIVE TOPICS
RewriteRule ^forum/active-topics(-([0-9]+))?\.html$ /forum/search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
# UNANSWERED TOPICS
RewriteRule ^forum/unanswered(-([0-9]+))?\.html$ /forum/search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
# NEW POSTS
RewriteRule ^forum/newposts(-([0-9]+))?\.html$ /forum/search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]
# THE TEAM
RewriteRule ^forum/the-team\.html$ /forum/memberlist.php?mode=leaders [QSA,L,NC]
# HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES

# FORUM WITHOUT ID & DELIM
# THESE THREE LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^forum/([a-z0-9_-]+)/?(page([0-9]+)\.html)?$ /forum/viewforum.php?forum_uri=$1&start=$3 [QSA,L,NC]
# END PHPBB PAGES


running it through the Helicon config editor I get 3 errors

Code: Select all
# # Line 5: (Unknown expression)   RewriteBase /

# # Line 46: (Unknown expression)   RewriteCond %{REQUEST_FILENAME} !-f
# # Line 47: (Unknown expression)   RewriteCond %{REQUEST_FILENAME} !-d






But I have also tried several others like this one

Code: Select all
httpd.ini pour le mod rewrite phpBB SEO Avancé

1) On démarre Isapi rewrite.
Code:
[ISAPI_Rewrite]


2) Optionnel retrait de index.php : redirection HTTP 301 de -http://www.example.com/phpBB/index.php vers -http://www.example.com/phpBB/
Code:
RewriteRule  /index.php http://www.herbalistsguide.com/phpBB/ [I,O,RP,L] 



3) Les rewriterules du mod rewrite phpBB SEO Avancé :
Code:

# FORUM PROTECTION RULE
#RewriteRule /.+/([^/]+\.html)$ / [I,O,RP,L] 
# CATEGORIES
RewriteRule /.+-vc([0-9]+)\.html$ /index.php\?c=$1 [I,L]
# PAGINATED FORUM
RewriteRule /.+-vf([0-9]+)-([0-9]+)\.html$ /viewforum.php\?f=$1&start=$2 [I,L]
# FORUM
#RewriteRule /.+-vf([0-9]+)\.html$ /viewforum.php\?f=$1 [I,L]
RewriteRule /.+-vf([0-9]+)\.html(?:\?(.*))? /viewforum.php\?f=$1?2&$2: [I,L]
# PAGINATED TOPIC
RewriteRule /.+-vt([0-9]+)-([0-9]+)\.html$ /viewtopic.php\?t=$1&start=$2 [I,L]
# TOPIC
RewriteRule /.+-vt([0-9]+)\.html(?:\?(.*))? /viewtopic.php\?t=$1?2&$2: [I,L]
#RewriteRule /.+-vt([0-9]+)\.html$ /viewtopic.php\?t=$1 [I,L]
# POST
RewriteRule /post([0-9]+)\.html$ /viewtopic.php\?p=$1 [I,L]
#PROFILES
RewriteRule /member([0-9]+)\.html$ /profile.php\?mode=viewprofile&u=$1 [I,L]
# END PHPBB PAGES 


4) Si nécésaire : Les rewriterules de mx Sitemaps (version mod rewrite phpBB SEO Avancé )
Code:
#mx Sitemaps
RewriteRule /sitemaps\.html$ /sitemaps.php [I,L]
RewriteRule /forum-map\.html$ /sitemaps.php\?fim [I,L]
RewriteRule /.+-fmp([0-9]+)-([0-9]+)\.html$ /sitemaps.php\?fmp=$1&start=$2 [I,L]
RewriteRule /.+-fmp([0-9]+)\.html$ /sitemaps.php\?fmp=$1 [I,L]
RewriteRule /.+-sc([0-9]+)\.html$ /sitemaps.php\?c=$1 [I,L]


5) Si nécésaire : Les rewriterules de mx Google Sitemaps
Code:
# mx Google sitemaps
RewriteRule /sitemaps\.xml$ /sitemap.php\ [L]
RewriteRule /forum-sitemap-([0-9]+)\.xml$ /sitemap.php\?fid=$1 [L]
RewriteRule /sitemap-forum\.xml$ /sitemap.php\?forum [L]



On another note I get this as well

Code: Select all
General Error
SQL ERROR [ mysqli ]

Table 'hgforum.phpbb3_gym_config' doesn't exist [1146]

SQL

SELECT * FROM phpbb3_gym_config

BACKTRACE


FILE: includes/db/mysqli.php
LINE: 143
CALL: dbal->sql_error()

FILE: gym_sitemaps/includes/gym_common.php
LINE: 48
CALL: dbal_mysqli->sql_query()

FILE: includes/acp/acp_gym_sitemaps.php
LINE: 73
CALL: obtain_gym_config()

FILE: includes/functions_module.php
LINE: 471
CALL: acp_gym_sitemaps->main()

FILE: adm/index.php
LINE: 74
CALL: p_master->load_active()


Probably something simple but after a 30 min instal I thought I would be up and running in no time - that was 9 hours ago. :(
Last edited by Drew on Sun Aug 31, 2008 5:37 pm, edited 1 time in total.
Drew
 
Posts: 22
Joined: Mon Dec 24, 2007 7:22 am
Location: raleigh nc

Advertisement

Postby Drew » Sun Aug 31, 2008 4:30 pm

phpBB SEO url rewriting solution by the way work nicely with IIS server running the isapi_rewrite module, just a matter of small adaptation in the httpd.ini.


And what would that adaptation be?

Anyone ??
Drew
 
Posts: 22
Joined: Mon Dec 24, 2007 7:22 am
Location: raleigh nc

Postby Drew » Sun Aug 31, 2008 7:30 pm

Re installed the package with no error popups except for Isapi_rewrite

Image
Drew
 
Posts: 22
Joined: Mon Dec 24, 2007 7:22 am
Location: raleigh nc

Postby dcz » Mon Sep 01, 2008 9:19 am

Code: Select all
[ISAPI_Rewrite]
#####################################################
# PHPBB SEO REWRITE RULES - ADVANCED
#####################################################
# AUTHOR : dcz www.phpbb-seo.com
# STARTED : 01/2006
#################################
# FORUMS PAGES
###############
# FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX
# RewriteRule ^/forum/forum\.html(?:\?(.*))?$ /forum/index.php\??1&$1: [I,L]
# FORUM
RewriteRule ^/forum/[a-z0-9_-]*-f([0-9]+)/?(page([0-9]+)\.html)?(?:\?(.*))?$ /forum/viewforum.php\?f=$1&start=$3?4&$4: [I,L]
# TOPIC WITH VIRTUAL FOLDER
RewriteRule ^/forum/[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html(?:\?(.*))?$ /forum/viewtopic.php\?f=$1&t=$2&start=$4?5&$5: [I,L]
# GLOBAL ANNOUNCES WITH VIRTUAL FOLDER
RewriteRule ^/forum/announces/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html(?:\?(.*))?$ /forum/viewtopic.php\?t=$1&start=$3?4&$4: [I,L]
# TOPIC WITHOUT FORUM ID & DELIM
RewriteRule ^/forum/([a-z0-9_-]*)/?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html(?:\?(.*))?$ /forum/viewtopic.php\?forum_uri=$1&t=$2&start=$4?5&$5: [I,L]
# PROFILES SIMPLE
RewriteRule ^/forum/member([0-9]+)\.html(?:\?(.*))?$ /forum/memberlist.php\?mode=viewprofile&u=$1?2&$2: [I,L]
# USER MESSAGES SIMPLE
RewriteRule ^/forum/member([0-9]+)-(topics|posts)(-([0-9]+))?\.html(?:\?(.*))?$ /forum/search.php\?author_id=$1&sr=$2&start=$4?5&$5: [I,L]
# GROUPS SIMPLE
RewriteRule ^/forum/group([0-9]+)(-([0-9]+))?\.html(?:\?(.*))?$ /forum/memberlist.php\?mode=group&g=$1&start=$3?4&$4: [I,L]
# POST
RewriteRule ^/forum/post([0-9]+)\.html$ /forum/viewtopic.php\?p=$1?2&$2: [I,L]
# ACTIVE TOPICS
RewriteRule ^/forum/active-topics(-([0-9]+))?\.html(?:\?(.*))?$ /forum/search.php\?search_id=active_topics&start=$2&sr=topics?3&$3: [I,L]
# UNANSWERED TOPICS
RewriteRule ^/forum/unanswered(-([0-9]+))?\.html(?:\?(.*))?$ /forum/search.php\?search_id=unanswered&start=$2&sr=topics?3&$3: [I,L]
# NEW POSTS
RewriteRule ^/forum/newposts(-([0-9]+))?\.html(?:\?(.*))?$ /forum/search.php\?search_id=newposts&start=$2&sr=topics?3&$3: [I,L]
# THE TEAM
RewriteRule ^/forum/the-team\.html(?:\?(.*))?$ /forum/memberlist.php\?mode=leaders?1&$1: [I,L]
# HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES

# FORUM WITHOUT ID & DELIM
# THESE THREE LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY

RewriteRule ^/forum/([a-z0-9_-]+)/?(page([0-9]+)\.html)?(?:\?(.*))?$ /forum/viewforum.php\?forum_uri=$1&start=$3?4&$4: [I,L]
# END PHPBB PAGES


should do it, in your domain's root.

The transformation is quite simple, here is an example :
Code: Select all
# TOPIC WITH VIRTUAL FOLDER
RewriteRule ^forum/[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /forum/viewtopic.php?f=$1&t=$2&start=$4 [QSA,L,NC]


becomes :
# TOPIC WITH VIRTUAL FOLDER
RewriteRule ^/forum/[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html(?:\?(.*))?$ /forum/viewtopic.php\?f=$1&t=$2&start=$4?5&$5: [I,L]


You just need to set the proper number in the ?5&$5: [I,L] part, it's just +1 of the highest $number before 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: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby Drew » Mon Sep 01, 2008 4:03 pm

Thank you very much for your efforts, I appreciate that

Unfortunately I'm still getting a 404 error and I have included a screenshot for you to evaluate. Helicon seems to be making use of the .htaccess file in Apache compatibility mode. And so we have done away with the httpd.ini file.

I have included the directory structure and as you can see the .htaccess file is loaded in the root.

As you can also see from the screen shot; using regex I am still getting a pattern match not found error.

Your seomod phpbb 3 package was reloaded yesterday afternoon and the installation again went as smoothly as a normal phpbb installation. Are there some additional steps that we need to take that we have missed?


Image
Drew
 
Posts: 22
Joined: Mon Dec 24, 2007 7:22 am
Location: raleigh nc

Postby Drew » Tue Sep 02, 2008 5:32 am

This ended up being the one that worked. After upgrading to ISAPI 3.0.56 for Apache rewrite compatability, and struggling with this for days, it turned out that leaving a blank httpd.ini file in the root folder in addition to the .htaccess file made it work for us.

[code# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.56

RewriteEngine On

RewriteBase /

# Rewrite Rules - Advanced

# Forum Index
RewriteRule ^forum.html/\$ /forum/index.php [QSA,L,NC]

# Forum
RewriteRule ^[a-z0-9_-]*-f([0-9]+)/?(page([0-9]+)\.html)?$ /forum/viewforum.php?f=$1&start=$3 [QSA,L,NC]

# Topic With Virtual Folder
RewriteRule ^[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /forum/viewtopic.php?f=$1&t=$2&start=$4 [QSA,L,NC]

# Global Announces With Virtual Folder
RewriteRule ^announces/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /forum/viewtopic.php?t=$1&start=$3 [QSA,L,NC]

# Topic Without Forum Id & Delimiter
RewriteRule ^([a-z0-9_-]*)/?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /forum/viewtopic.php?forum_uri=$1&t=$2&start=$4 [QSA,L,NC]

# Profiles Simple
RewriteRule ^member([0-9]+)\.html$ /forum/memberlist.php?mode=viewprofile&u=$1 [QSA,L,NC]

# User Messages Simple
RewriteRule ^member([0-9]+)-(topics|posts)(-([0-9]+))?\.html$ /forum/search.php?author_id=$1&sr=$2&start=$4 [QSA,L,NC]

# Group Simple
RewriteRule ^group([0-9]+)(-([0-9]+))?\.html$ /forum/memberlist.php?mode=group&g=$1&start=$3 [QSA,L,NC]

# Post
RewriteRule ^post([0-9]+)\.html$ /forum/viewtopic.php?p=$1 [QSA,L,NC]

# Active Topics
RewriteRule ^active-topics(-([0-9]+))?\.html$ /forum/search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]

# Unanswered Topics
RewriteRule ^unanswered(-([0-9]+))?\.html$ /forum/search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]

# New Posts
RewriteRule ^newposts(-([0-9]+))?\.html$ /forum/search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]

# The Team
RewriteRule ^the-team\.html$ /forum/memberlist.php?mode=leaders [QSA,L,NC]


# Forum Without Id & Delimiter
# These Three Lines Must Be Located At The End Of Your Htaccess To Work Properly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9_-]+)/?(page([0-9]+)\.html)?$ /forum/viewforum.php?forum_uri=$1&start=$3 [QSA,L,NC]


<Helicon>
</Helicon>[/code]
Drew
 
Posts: 22
Joined: Mon Dec 24, 2007 7:22 am
Location: raleigh nc

Postby Drew » Tue Sep 02, 2008 4:55 pm

Here is a snippet of the log file from Helicon\ISAPI_Rewrite3

(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request c:\inetpub\082-herbalist\.htaccess
(3) applying pattern '^/httpd(?:\.ini|\.parse\.errors).*$' to uri 'forum/index.php'
(3) applying pattern '^.*\.isrwhlp$' to uri 'forum/index.php'
(3) applying pattern '^forum\.html$' to uri 'forum/index.php'
(3) applying pattern '^/forum[a-z0-9_-]*-f([0-9]+)(-([0-9]+))?\.html$' to uri 'forum/index.php'
(3) applying pattern '^[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$' to uri 'forum/index.php'
(3) applying pattern '^announces/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$' to uri 'forum/index.php'
(3) applying pattern '^([a-z0-9_-]*)/?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$' to uri 'forum/index.php'
(3) applying pattern '^member([0-9]+)\.html$' to uri 'forum/index.php'
(3) applying pattern '^member([0-9]+)-(topics|posts)(-([0-9]+))?\.html$' to uri 'forum/index.php'
(3) applying pattern '^group([0-9]+)(-([0-9]+))?\.html$' to uri 'forum/index.php'
(3) applying pattern '^post([0-9]+)\.html$' to uri 'forum/index.php'
(3) applying pattern '^active-topics(-([0-9]+))?\.html$' to uri 'forum/index.php'
(3) applying pattern '^unanswered(-([0-9]+))?\.html$' to uri 'forum/index.php'
(3) applying pattern '^newposts(-([0-9]+))?\.html$' to uri 'forum/index.php'
(3) applying pattern '^the-team\.html$' to uri 'forum/index.php'
(3) applying pattern '^([a-z0-9_-]+)(-([0-9]+))\.html$' to uri 'forum/index.php'
(3) applying pattern '^([a-z0-9_-]+)\.html$' to uri 'forum/index.php'


As you can see everything was being encoded to' forum/index.php' which then returned an error.

Hopefuully this will be helpful
Drew
 
Posts: 22
Joined: Mon Dec 24, 2007 7:22 am
Location: raleigh nc

Postby dcz » Sat Sep 06, 2008 8:52 am

Have you tried only with the httpd.ini I suggested (no .htaccess or compatibility mode) ?

In your last .htaccess :
Code: Select all
RewriteRule ^forum.html/\$ /forum/index.php [QSA,L,NC]


Is wrong in all cases IMO, should rather be :
Code: Select all
RewriteRule ^forum/forum.html$ /forum/index.php [QSA,L,NC]


For a root .htaccess and phpBB installed in 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: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby Drew » Sat Sep 06, 2008 4:30 pm

We tried first with httpd.ini but in the end we upgraded from 3.0.039 to 3.1.056 and used .htaccess

You are correct that the rule as stated did not work for index.php

we re-wrote it as:
Code: Select all
# Forum Index
RewriteRule ^forum\.html$ /forum/index.php [QSA,L,NC]

this seems to work

Is there any thing in the way we have written the rule that will cause trouble?

* Edit*
I plugged in
Code: Select all
RewriteRule ^forum/forum.html$ /forum/index.php [QSA,L,NC]

Which returns a 404 - .htaccess in in the root
Drew
 
Posts: 22
Joined: Mon Dec 24, 2007 7:22 am
Location: raleigh nc

Postby dcz » Sat Sep 13, 2008 8:04 am

ho, you must be using the virtual root option then.

You could try the httpd.ini, should work as well if you just replace all occurrences of "^/forum" with "^", eg replace :
Code: Select all
RewriteRule ^/forum/forum\.html(?:\?(.*))?$ /forum/index.php\??1&$1: [I,L]

with
Code: Select all
RewriteRule ^/forum\.html(?:\?(.*))?$ /forum/index.php\??1&$1: [I,L]


and so on.

It's a good news though if isapi_rewrite is now able to deal with .htaccess, just make sure that the mod_rewrite QSA flag is properly working, it's the option that will allow you to load urls such as example.com/forum-url.html?variable=value (for advanced sorting for example).

The QSA mod_rewrite flag is handled by the (?:\?(.*))? and ?1&$1: part in the httpd.ini rewriterule example.

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


Return to Advanced SEO URL

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 6 guests


 
cron