Help related to Mod Rewrite

Discussion in 'Apache' started by superprg, Jan 6, 2011.

  1. #1
    This works

    redirect 301 "/old_page.htm" http://localhost/zcart/index.php

    and also this
    redirect 301 "/ab_cart/catalog/index.php" http://localhost/zcart/index.php

    I am trying to redirect

    http://localhost/ab_cart/catalog/index.php?cPath=10
    to
    http://localhost/zcart/index.php?main_page=index&cPath=1

    so I wrote this
    
    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^cPath=10$
    RewriteRule ^/ab_cart/catalog/index.php$ http://localhost/zcart/index.php?main_page=index&cPath=1? [R=301,L]
    
    Code (markup):
    but it doesnt works
    Any clue what I am doing wrong

    Even a simple redirect like (http://localhost/news/article?id=17641397 TO http://localhost/index.php?id=17641395)

    
    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^id=17641397$
    RewriteRule ^/news/article$ http://localhost/index.php?id=17641395? [R=301,L]
    
    Code (markup):
    doesnt seems to be working
     
    superprg, Jan 6, 2011 IP