Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite question.

         

tftd

2:00 am on Aug 7, 2008 (gmt 0)

10+ Year Member



Hey,

I was wondering if you could make direct access to a link impossible.
What I want to do is if you access index.php?act=test directly to be redirected to index/act/test .
If I do that with RewriteRule when you get redirected to index/act/test you'll go in an endless cycle. I'm aware of RewriteCond but I'm not quite sure how to use it in this case.

Any ideas ?

Thanks in advance,
tftd

jdMorgan

3:42 am on Aug 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you mean, "How can I externally redirect direct client requests for a script+query string (dynamic) URL to a static URL, while at the same time allowing that static URL to be internally rewritten to the script with a query string, all without causing a loop?"

If so, then the key is to use a RewriteCond to examine the client request header %{THE_REQUEST} and do the redirect only if the dynamic URL is being directly-requested by the client, and not as the result of a previously-executed internal rewrite.

Lots more details here [webmasterworld.com]:

Jim

tftd

10:54 am on Aug 8, 2008 (gmt 0)

10+ Year Member



Thank you jdMorgan. You are a life savior !