Need help with some simple coding which I'm confused about

Discussion in 'BlackHat Lounge' started by brent360, May 4, 2011.

  1. brent360

    brent360 Junior Member

    Feb 16, 2011
    Likes Received:
    Howdy guys. I need a little help with mod_rewrite.

    On one of my websites I use a query string appended to the root domain to pass a variable into a php function which decides how to display the page. Example: will pass "whatever" to my "stuffhere" function which transforms a shortcode on the page according to the rules outlined in a "whatever" file. After a certain amount of time on the page, "whatever" instructs the page to redirect to another one and to disallow visitors from reaching the page displayed with the original query string attached (using cookies/host as a reference).

    I use mod_rewrite to transform to for the sake of user-friendliness.

    Here's my problem:
    When the function finally redirects the end-user away from to, the URL transforms back to the non-rewritten URL (thereby demonstrating the query string). (So upon redirection, the URL displays instead of

    Anyone know how to fix this? Should be something simple and quick but I'm not particularly familiar with mod_rewrite or permalink rewrites in general.

    To clarify: I want to maintain the format even after the redirect which prompts the URL transformation. I'm looking to accomplish this with a rewrite rule--I'm sure it's possible but I have no clue why it wouldn't automatically maintain the rewrite to begin with.

    Current rule:
    RewriteRule ^stuffhere/([^/]*)/$ /?stuffhere=$1 [L]