Mod Rewrite Issues

Discussion in 'Site & Server Administration' started by Marx, Nov 25, 2008.

  1. #1
    Hi

    I am having issues getting a url rewrite to work ? the problem is outlined below, any help would be greatly appreciated ?

    RewriteEngine On
    RewriteRule ^/~(.+) http://example.com/products/~$1 [R,L]

    I also enabled the rewrite logging to enable to track the re-write attempt, as below:

    RewriteLog logs/rewrite.log
    RewriteLogLevel 9

    When I navigate to http://example.com/products - we see the following in the rewrite logs, and we do not seem to redirect:

    172.20.133.132 - - [11/Nov/2008:17:50:53 +0000] [http://example.com/sid#a8ce0][rid#815668/initial] (2) init rewrite engine with requested uri /products
    172.20.133.132 - - [11/Nov/2008:17:50:53 +0000] [http://example.com/sid#a8ce0][rid#815668/initial] (3) applying pattern '^/~(.+)' to uri '/products'
    172.20.133.132 - - [11/Nov/2008:17:50:53 +0000] [http://example.com/sid#a8ce0][rid#815668/initial] (1) pass through /products

    Likewise, when we navigate to: http://example.com/portal/site/ecom/siteproducts - we see the following in the rewrite logs, and we do not seem to redirect:

    172.20.133.132 - - [11/Nov/2008:17:53:10 +0000] [http://example.com/sid#a8ce0][rid#9128e0/initial] (2) init rewrite engine with requested uri /portal/site/skycom/siteproducts
    172.20.133.132 - - [11/Nov/2008:17:53:10 +0000] [http://example.com/sid#a8ce0][rid#9128e0/initial] (3) applying pattern '^/~(.+)' to uri '/portal/site/skycom/siteproducts'
    172.20.133.132 - - [11/Nov/2008:17:53:10 +0000] [http://example.com/sid#a8ce0][rid#9128e0/initial] (1) pass through /portal/site/skycom/siteproducts

    It seems that we’re unable to match the “^/~(.+)” pattern in the rewrite rule and consequently pass through the requests for /products and /portal/site/skycom/siteproducts.

    Thanks Marx
     
    Marx, Nov 25, 2008 IP