Link to home
Start Free TrialLog in
Avatar of arantius
arantius

asked on

rewrite mod_rewrite rules to work with 1.3

I have a set of rules for mod_rewrite, which happened to be set up on a server running apache 2.  I'm considering moving hosts for stability, and where I'd end up is running 1.3, and I found out they use different regex cores, so the rules below don't work.  Points go to who can rewrite the rules below to work properly in 1.3.  I'm pretty sure it is the question marks that 1.3 cannot handle, they're in place to make things work whether the slash is at the end of the "directory" name or not.  These rules rather clearly present search-engine-friendly URLs for dynamic documents.

  RewriteEngine On
  RewriteBase /
  RewriteRule ^news/archive/(.*)\.(.*)\.html$ news.php?do=archive&feedID=$1&start=$2  [L]
  RewriteRule ^news/archive/(.*)\.html$       news.php?do=archive&feedID=$1           [L]
  RewriteRule ^news/(read/)?$                 news.php?do=read                        [L]
  RewriteRule ^newarticle/(.*?)/?$            newarticle.php?blog=$1                  [L]
  RewriteRule ^newarticle/?$                  /                                       [L,R]
  RewriteRule ^comment/(.*?)/(.*?)/?$         comment.php?blog=$1&article=$2          [L]
  RewriteRule ^comment/(.*?)/?$               /blog/$1/                               [L,R]
  RewriteRule ^comment/?$                     /                                       [L,R]
  RewriteRule ^article/(.*?)/(.*?)/?$         article.php?blog=$1&article=$2          [L]
  RewriteRule ^article/(.*?)/?$               /blog/$1/                               [L,R]
  RewriteRule ^article/?$                     /                                       [L,R]
  RewriteRule ^archive/(.*?)/(.*?)/?$         /archive.php?blog=$1&start=$2           [L]
  RewriteRule ^archive/(.*?)/?$               /archive.php?blog=$1                    [L]
  RewriteRule ^archive/?$                     /                                       [L,R]
  RewriteRule ^stumble/(.*?)/(.*?)/?$         /stumble.php?blog=$1&start=$2           [L]
  RewriteRule ^stumble/(.*?)/?$               /stumble.php?blog=$1                    [L]
  RewriteRule ^stumble/?$                     /                                       [L,R]
  RewriteRule ^games/game\.(.*?)\.html$       /games/index.php?gameID=$1              [L]
  RewriteRule ^games/game-([\d]+)/?$          /games/index.php?gameID=$1              [L]
  RewriteRule ^topic/(.*?)/(.*?)/?$           topic.php?blog=$1&topic=$2              [L]
  RewriteRule ^topic/(.*?)/?$                 /topic.php?blog=$1                      [L]
  RewriteRule ^topic/?$                       topic.php                               [L]
  RewriteRule ^blog/(.*?)/?$                  blog.php?blog=$1                        [L]
  RewriteRule ^blog/?$                        /                                       [L,R]
ASKER CERTIFIED SOLUTION
Avatar of kalosi
kalosi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arantius
arantius

ASKER

Not 100% tested but oh ! So simple, thanks !
Well I've already accepted, but now that I test it, this answer does not work at all.
Well go ahaed - which ones doesn't work ?