Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite Beginner Q

Direct request vs. redirect

         

justgowithit

2:15 am on Feb 8, 2007 (gmt 0)

10+ Year Member



I’m new to mod rewrite (I have about 2 hours under my belt ;)) so please bear with me if this question/issue is old news. I’m creating basic rules to make dynamic urls more friendly. All is moving along well with one exception.

My rules are working fine but I can still call the original URL with a direct request. I’d rather that this not be possible.

For example:

rewriteRule ^my_page /([0-9+])/$ my_page.php?p=$1 //works fine when I call www.mysite.com/my_page/1/

…. but I can still call www.mysite.com/my_page.php?p=8 with a direct request which I would like to avoid.

Is the solution to write another rule to direct the original URL to the redirect form? - i.e. my_page/1/

jdMorgan

2:28 am on Feb 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's the whole procedure in a nutshell, from our library: Changing Dynamic URLs to Static URLs [webmasterworld.com].

Jim

justgowithit

2:09 pm on Feb 8, 2007 (gmt 0)

10+ Year Member



Thanks JD, that's what I needed.