Why is this mod_rewrite changing the visible URL!?

Discussion in 'Apache' started by mitya33, Jan 8, 2012.

  1. #1
    Hi all - first time poster.

    This is driving me crazy.

    The following rewrite rule works BUT it changes the visible URL. I don't want it to.

    RewriteCond %{QUERY_STRING} (module)=([^&]*)
    RewriteRule ^(.+?)(\/[^\/]+)?$ $1/%1%2? [NE]
    
    Code (markup):
    (should change a URL like /page?module=12345 into /page/module12345)

    I've read lots about mod_rewrite flags and modifiers, but cannot get this rewrite to be invisible.

    Worse, I have other redirects that look similar in construction, which DO work invisibly, e.g.

    RewriteCond %{QUERY_STRING} (ITEM_ENT_ID)=([^&]*)
    RewriteRule ^(.+?)(\/[^\/]+)?$ $1/%1%2$2? [NE]
    
    Code (markup):
    Where am I going wrong? Any help appreciated.

    Thanks in advance
     
    mitya33, Jan 8, 2012 IP