Rewrite of URLS works with .htaccess, but not when added to apache

Discussion in 'Apache' started by smi, Aug 20, 2006.

  1. #1
    To decrease load on a server, the admin moved my rewrite rules from my .htaccess to apache. Here is the explanation:

    "I have moved the code from the .htaccess file to the apache config. Whenever
    you have rewrite rules in your .htaccess config, each line of those rules is
    read for every single hit on your site, including each image pulled, etc. So
    when you have a lot of traffic, this can cause issues.

    When moved to the apache config, it allows it to load it on start of apache,
    so the rules are already loaded in to memory, and don't have to be loaded
    separately for every hit. "

    The problem is that this caused everything to go 404. When I added the original .htaccess again, all worked.

    So, here is my .htaccess, can you find any reasons for why it should work when in a .htaccess file, but not when loaded in apache?

    #start .htaccess code
    RewriteEngine On

    RewriteRule ^show/(.*)/(.*).htm index.php?bdy=show&id=$2
    RewriteRule ^comment/(.*)/(.*) index.php?bdy=comment&id=$1
    RewriteRule ^archive(.*) index.php?bdy=archive&p=$1​
     
    smi, Aug 20, 2006 IP
  2. Nick_Mayhem

    Nick_Mayhem Notable Member

    Messages:
    3,486
    Likes Received:
    338
    Best Answers:
    0
    Trophy Points:
    290
    #2
    Change the host. :)

    This is the last solution that I can give you. Bcoz I have also never heard of something like this. But he maybe right.
     
    Nick_Mayhem, Aug 20, 2006 IP