|
Home > Archive > Apache Server configuration support > May 2006 > Rewrite rule - works in Apache 2.x but not 1.3.x
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Rewrite rule - works in Apache 2.x but not 1.3.x
|
|
|
| Are there some extra directives required for rewrite rules on 1.3.x or
is the syntax different to that of 2.x?
The following rewrite rules work fine in Apache 2.x but cause a 500
Internal server error on 1.3.x. Error logs report "RewriteRule: cannot
compile regular expression" - this happens for every rule below.
Any ideas anyone?
RewriteEngine on
# Some 301s will help google and preserve old links
#RewriteRule ^index.php/board,([0-9]*).([0-9]*).html
smfseo_redirect.php?b=$1&start=$2 [R=301,L]
#RewriteRule ^index.php/topic,([0-9]*).((?:from|msg|new|)[0-9]*).html
smfseo_redirect.php?t=$1&start=$2 [R=301,L]
#RewriteRule
^index.php/topic,([0-9]*).((?:from|msg|new|)[0-9]*)/((?:boardseen|topicseen)).html
smfseo_redirect.php?t=$1&start=$2;$3 [R=301,L]
# New board URLs
RewriteRule ^([\-a-zA-Z0-9]*)/index.([0-9]*).html;(sort=[a-zA-Z]*)
index.php?board=$1.$2&$3 [L]
RewriteRule ^([\-a-zA-Z0-9]*)/index.([0-9]*).html index.php?board=$1.$2 [L]
# New topic URLs
RewriteRule
^([\-a-zA-Z0-9]*)/([\-a-zA-Z0-9]*).((?:from|msg|new|)[0-9]*).html(.*)
index.php?topic=$2.$3
| |
| Robert Ionescu 2006-05-29, 5:40 pm |
| BlueC wrote:
> The following rewrite rules work fine in Apache 2.x but cause a 500
> "RewriteRule: cannot compile regular expression"
You'er using PCRE, but Apache 1.3 ships with POSIX Ext. RegEx.
Eg. '?:' is a PCRE.
--
Robert
| |
|
| Robert Ionescu wrote:
> BlueC wrote:
>
> You'er using PCRE, but Apache 1.3 ships with POSIX Ext. RegEx.
>
> Eg. '?:' is a PCRE.
>
Wonderful, thank you! This has been driving me mad and nowhere could I
find what the differences are in Regex between 1.3.x and 2.x.
Looks like 1.3.x will just need a couple extra rewrite rules to achieve
the same thing.
Many thanks!
Chris
| |
| Robert Ionescu 2006-05-29, 5:40 pm |
| BlueC wrote:
> Looks like 1.3.x will just need a couple extra rewrite rules to achieve
> the same thing.
No, just remove ?: and change the backreferences, i.e. in one rule $3 to $4:
# Some 301s will help google and preserve old links
RewriteRule ^index\.php/board,([0-9]*)\.([0-9]*)\.html
smfseo_redirect.php?b=$1&start=$2 [R=301,L]
RewriteRule ^index\.php/topic,([0-9]*)\.((from|msg|new|)[0-9]*)\.html
smfseo_redirect.php?t=$1&start=$2 [R=301,L]
RewriteRule
^index\.php/topic,([0-9]*)\.((from|msg|new|)[0-9]*)/((boardseen|topicseen))\.html
smfseo_redirect.php?t=$1&start=$2;$4 [R=301,L]
# New board URLs
RewriteRule ^([\-a-zA-Z0-9]*)/index\.([0-9]*)\.html;(sort=[a-zA-Z]*)
index.php?board=$1.$2&$3 [L]
RewriteRule ^([\-a-zA-Z0-9]*)/index\.([0-9]*)\.html
index.php?board=$1.$2 [L]
# New topic URLs
RewriteRule
^([\-a-zA-Z0-9]*)/([\-a-zA-Z0-9]*).((from|msg|new|)[0-9]*).html
index.php?topic=$2.$3 [L]
--
Robert
|
|
|
|
|