rule consolidation

Discuss practical ways rearrange URLs using mod_rewrite.

rule consolidation

Postby johnnybravoh » Wed Feb 18, 2004 9:24 pm

hello all,
I have the following RewriteRule in action (.htaccess) - BTW I
also have access to httpd.conf if needed...:

RewriteRule ^[sS]ubject[/]?(.*)$ /subs/subject/$1 [C]
RewriteRule /profile/([0-9]+)[/]? /sub/subject/ch_profile.php?ID=$1 [C]
RewriteRule /profile/([0-9]+)/(.*)$
/sub/subject/ch_profile.php?ID=$1&CallBackURL=$2 [L]

RewriteRule ^[oO]bject[/]?(.*) /subs/object/$1 [C]
RewriteRule /profile/([0-9]+)[/]? /sub/object/ch_profile.php?ID=$1 [C]
RewriteRule /profile/([0-9]+)/(.*)$
/sub/object/ch_profile.php?ID=$1&CallBackURL=$2 [L]

What I want to do is allow the following
http://www.mydomain.com/subject/anyfile --> http://www.mydomain.com/sub/suject/anyfile
http://www.mydomain.com/subject/profile/2 --> http://www.mydomain.com/sub/suject/ch_profile.php?ID=2
http://www.mydomain.com/subject/profile/2/blahblah --> http://www.mydomain.com/sub/suject/ch_p ... L=blahblah

The RewriteRules currently work, but it seems very inefficient.
1) Can the 3 RewriteRules for subject be combined into 1 RewriteRule????
2) Can the 2 sets of RewriteRules be combined to make a single set that
accounts for both subject, object and other possible directories under sub?


Thanks in advance for any help!

Jon Wah
johnnybravoh
 

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 27 guests

cron