Forum Moderators: phranque

Message Too Old, No Replies

I need some mod rewrite help

         

dualfragment

11:37 pm on Aug 21, 2006 (gmt 0)

10+ Year Member



Ok, my current ruleset:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule ^([^/\.]+)/?$ profile.php?id=$1 [L]

What I want to happen so far:

I want example.com to be rewritten to www.example.com, which works fine. Also, I have www.example.com/X to rewrite www.example.com/profile.php?id=X.

My new problem, is that the above rule prevents users from accessing www.example.com/forum. I would actually like www.example.com/forum do a redirect to forum.example.com, but I can't figure out how to do this and make everything else above work.

jdMorgan

12:18 pm on Aug 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think you mean you want to wxclude requests for /forum from being rewritten to the profile script. If that's the case, add a RewriteCond with a negative match, so that /forum requests pass through the second rule unchanged.

RewriteCond %{REQUEST_URI} !^/forum

Then add a third rule to redirect /forum requests to the forum subdomain.

Jim

dualfragment

5:08 pm on Aug 22, 2006 (gmt 0)

10+ Year Member



Thanks a ton! That solved the problem.