Forum Moderators: phranque
I have written a mod_rewrite for my cms it works on apache 2.2 but when I upload it to a server that is using 1.3 it no longer works and it doesnt work on my localhost when I run apache 1.3 I cannot seem to find the problem with this....here is the rewrite code
# ERROR DOCUMENTATIONS
ErrorDocument 404 /dev/index.php?page=404# START REWRITE ENGINE
RewriteEngine on
Options +FollowSymLinks
# GAME FILTER PARSER
# These will only be called one time we dont catergorize
# games as http://site.com/game/etc we set a cookie for that
# Game Filter
RewriteRule ^game_filter/([0-9]+)?$ index.php?page=game_filter&game_id=$1 [L]
# Main
RewriteRule ^/([A-Za-z-_0-9]+)/?$ index.php?page=$1 [L]
# News
RewriteRule ^/([0-9]+)?$ index.php?p=$1 [NC,L]
RewriteRule ^news/([A-Za-z]+)?$ index.php?page=news&func=$1 [NC,L]
RewriteRule ^news/view_news/([0-9]+)?$ index.php?page=news&func=view_news&news_id=$1 [NC,L]
RewriteRule ^news/post_comments/([0-9]+)?$ index.php?page=news&func=post_comments&news_id=$1 [NC,L]
RewriteRule ^news/post_comments/([0-9]+)/([0-9]+)?$ index.php?page=news&func=post_comments&news_id=$1"e_id=$2 [NC,L]
RewriteRule ^news/view_news/([0-9]+)/([0-9]+)?$ index.php?page=news&func=view_news&news_id=$1&p=$2 [NC,L]
RewriteRule ^news/delete_comment/([0-9]+)?$ index.php?page=news&func=delete_comment&comment_id=$1 [NC,L]
RewriteRule ^news/delete_comment/([0-9]+)/1?$ index.php?page=news&func=delete_comment&comment_id=$1&confirm=1 [NC,L]
RewriteRule ^news/edit_comment/([0-9]+)?$ index.php?page=news&func=edit_comment&comment_id=$1 [NC,L]
# User
RewriteRule ^user/([A-Za-z_]+)?$ index.php?page=user&func=$1 [NC,L]
# Shows a user login with username prefilled :)
RewriteRule ^user/login/([0-9]+)?$ index.php?page=user&func=login&userid=$1 [L]
## Account Validation
RewriteRule ^user/validate_account/([0-9]+)/([A-Za-z-_0-9]+)?$ index.php?page=user&func=validate_account&userid=$1&validation=$2 [NC,L]
# Profile Views They are done By two ways CLan Members and Regular users CM = /players Users = /members
RewriteRule ^users/members/(.*)?$ index.php?page=profile&user=$1 [NC,L]
RewriteRule ^users/players/(A-Z0-9_-]+)?$ index.php?page=profile&user=$1 [NC,L]
# Roster
# Matches
# Forums
[edited by: ioanik at 12:46 pm (utc) on July 8, 2008]
It seems that 1.3 is not as friendly when it comes to regex mistakes....
if you look at line
RewriteRule ^/([A-Za-z-_0-9]+)/?$ index.php?page=$1 [L]
and
RewriteRule ^user/validate_account/([0-9]+)/([A-Za-z-_0-9]+)?$ index.php?page=user&func=validate_account&userid=$1&validation=$2 [NC,L]
the - needs to be escaped....simple fix :)
And i was getting a 500 Internal Error