Mod Rewrite Help

Shadow121

Member
Messages
901
Reaction score
0
Points
16
Code:
RewriteEngine on
RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([0-9]+)/$ index.php?x=$1&y=$2&id=$3
RewriteRule ^verificationimage.png$ FileLibrary/imgVerification.php
RewriteRule ^([a-zA-Z]+)/user/([0-9]+)/$ index.php?x=$1&user=$2
RewriteRule ^([a-zA-Z]+)/([0-9]+)/$ index.php?x=$1&membPage=$2
RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/$ index.php?x=$1&y=$2
RewriteRule ^header_image.png$ FileLibrary/header_img.php
RewriteRule ^([a-zA-Z]+)/([0-9]+)/$ index.php?x=$1&id=$2
RewriteRule ^([a-zA-Z]+)/$ index.php?x=$1
RewriteRule ^rss.xml$ rss.php

Alright, when I try to go to members/user/My ID/ it doesn't show the profile but instead, it shows the main users listing. Any help with this?
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
When you go to "members/user/My ID/", what's the resulting URL? You'll probably have to print it out within index.php.

The RewriteRule flags might have something to offer. For instance, the L flag will stop rewrite processing when a URL matches a rule (one of the other rules might be causing problems).

You can see what luck you have with Martin Melin's RewriteRule tester.

This won't help with this problem, but the 0-or-1-quantifier ("?") will let your RewriteRule match URLs that don't have a trailing "/" (e.g. try the pattern "^([a-zA-Z]+)/?$")
 

Shadow121

Member
Messages
901
Reaction score
0
Points
16
When I go to members/user/1/ it assumes that 1 is an ID instead of a user because of the rule at the very top.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Put the more specific rule (the one with the "^([a-zA-Z]+)/user/([0-9]+)/?$" pattern) before the more general rule. Use the [L]ast flag as an optimization (it probably won't help with correctness).
 
Top