Override RewriteRule in .htaccess

Discussion in 'Apache' started by Shreekanta, Nov 27, 2007.

  1. #1
    I have a htaccess file in my parent folder "test" which redirects all the .shtml files in the folder and sub folder to (http://www.abc.com/web/()/*.html)

    RewriteEngine on
    RewriteBase /test
    RewriteRule ^(.*)\.shtml http://www.abc.com/web/$1.html [R=301]

    for example: if I hit the URL as www.xyz.com/test/mydomain/a.shtml, it is redirecting to http://www.abc.com/web/mydomain/a.html

    But I couldn't over ride this RewriteRule in some of the sub folders like "/test/sridomain/" where i don't want to redirect it to www.xyz.com.

    Please guide me the syntax for overriding the parent rule in sub folder (/test/sridomain/) htaccess file.
     
    Shreekanta, Nov 27, 2007 IP
  2. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ummm a nasty way of doinging (quite sure someone else here can come up with better)

    would to be to put a rewrite rule on top of the one you want blocked, to match the url you don't want rewritten
    ie
    RewriteRule ^test/sridomain/$ /test/sridomain [L]

    the [L] means last rule, and it'll stop on that one.

    you could use RewriteCond, but i'm not sure of the varibles you'd need to do it.
     
    powerspike, Nov 27, 2007 IP