Weird .htaccess problem

Discussion in 'Apache Migration/Compatibility' started by haxan, Aug 23, 2007.

  1. haxan

    haxan New Member

    For some reason:

    RewriteRule ^tutorials([/]?)$ ./tutorials.php?page=1 [L]

    The above line of code is working and the bottom link IS NOT

    RewriteRule ^tutorials/([-_a-zA-Z0-9\.]+)([/]?)$ ./tutorials.php?cat=$1&page=1 [L]


    I tried and changed the the above line to :

    RewriteRule ^tutorial/([-_a-zA-Z0-9\.]+)([/]?)$ ./tutorials.php?cat=$1&page=1 [L]

    Removing only the letter 's' from tutorials and it seems to be working again.

    The problem now is that i need to use tutorials and not tutorial word.

    I am having this kinda problem with several other lines too.

    It used the work in Apache bytheway.


    Further more, another weird problem:

    I have a series of mod_rewrite lines written:

    RewriteRule ^search([/]?)$ ./doSearch.php [L]
    RewriteRule ^search/([-_a-zA-Z0-9\.]+)([/]?)$ ./doSearch.php?searchCat=$1 [L]
    RewriteRule ^search/([-_a-zA-Z0-9\.]+)/([0-9]+)([/]?)$ ./doSearch.php?searchCat=$1&page=$2 [L]
    RewriteRule ^search/([-_a-zA-Z0-9\.]+)/([-_a-zA-Z0-9\.]+)([/]?)$ ./doSearch.php?searchCat=$1&searchKeywords=$2 [L]
    RewriteRule ^search/([-_a-zA-Z0-9\.]+)/([-_a-zA-Z0-9\.]+)/([0-9]+)([/]?)$ ./doSearch.php?searchCat=$1&searchKeywords=$2&page=$3 [L]


    The above lines only work uptill search/this-is-a-test
    but fails when this url is used /search/this-is-a-test/2

    now i fixed the issue by replacing all the ^search/ with ^searc/ and this seems to work just fine.

    is the word ^search/ kinda reserved or something. :(
  2. mistwang

    mistwang LiteSpeed Staff

    Can you turn on rewrite logging with "RewriteLogLevel 9" in the vhost configuration section in httpd.conf? Then you will get a rewrite logs in lsws/logs/error.log
  3. haxan

    haxan New Member

    hmmm,


    yeah sure i can.


    bytheway i think i found out the problem

    the thing is that the htaccess file that i am using is some how merging with the one at the www domain. (i am on a subdomain)

    so its written in the htaccess on the www domain ^tutorials/([a-zA-Z]+)$ ./searchCategory.php?cat=$1 [L]

    and its written in the htaccess of the 'test' subdomain tutorials/([a-zA-Z]+)$ ./tutorials.php?cat=$1 [L]

    so it tries to find the searchCategory.php file which does not exist in that subdomain . (its in the www domain)

    got any clues how to stop letting the merge??
  4. mistwang

    mistwang LiteSpeed Staff

Share This Page