Need Clarification on URL Rewriting/Apache Rewrite

Discussion in 'General Scripting Chat' started by WildDisease, Sep 19, 2011.

  1. WildDisease

    WildDisease Junior Member

    Aug 3, 2011
    Likes Received:
    So I understand the concept of rewrite and why its done along with some basic regex to convert my ugly.php?foo=1&bar=2 urls into pretty ugly/1/2/ URLs.. great!

    But it seems Im missing something because any time I try to click the pretty URL, the address bar goes to the old URL.

    I tried to use a URL redirect checker (see hxxp:// where I inputted my pretty URL and it said it was 301ed to the ugly url.. I dont think this is what is supposed to happen.. I want the user to click the pretty link (the pretty link show up in the status bar), then when the user gets to the page he should be able to see the pretty URL he clicked..

    The basic RewriteRule template Im using is:
    RewriteRule ^aboutus/([^/\.]+)?$ content.php?$1 [R=301]
    (this one is not the last rule)

    i.e. hxxp:// should be written to hxxp://

    I tried putting in a pretty URL from WP and the internetofficer redirect checker called it a direct URL

    Btw.. I noticed when the R was there by the RewriteRule it was 302, and when I changed it to R=301 it went to 301 permanent so I kept it like this which I think is ok since ultimately I want google to crawl the pretty one
    Last edited: Sep 19, 2011