1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

script not found or unable to stat - MOD REWRITE

Discussion in 'Apache' started by the-ferret, May 5, 2007.

  1. #1
    I am trying to use a simple Mod Rewrite rule on my test server to take a url from localhost/category-1234.html to localhost/modtest.php?cat_id=1234 using the following .htaccess file (in C:\Program Files\Apache Group\Apache2\htdocs)

    RewriteEngine On
    RewriteRule ^category-([0-9]+)\.html$ modtest.php?cat_id=$1 [L]

    The apache error log shows "script not found or unable to stat " and browser returns 404.

    In the apache httpd.conf file I have uncommented
    LoadModule rewrite_module modules/mod_rewrite.so
    but I can not find an entry for
    AddModule mod_rewrite.c and if I add it manually then apache will not restart.

    Any ideas, is this an Apache issue or have I just cocked up the .htaccess entry?

    Thanks
     
    the-ferret, May 5, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Nintendo, May 5, 2007 IP
  3. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #3
    mod_rewrite works on any hostname. It's one thing to suggest that attempting it on localhost is the issue but going round stating as fact that it does not work on localhost is ridiculous, not to mention entirely inaccurate.

    I happily test out all my rewrites locally as I'm sure most other people do when building applications that make heavy use of URL rewriting. Just because you haven't setup your local server to have mod_rewrite working does not mean no one else can!

    A quick search through the official documentation reveals absolutely no mention of issues on localhost. Google search can do no better - yes, people having problems with their configuration but nothing whatsoever to suggest that localhost is the problem.

    But most of all its common sense - the mod_rewrite module has nothing to do with the hostname. Sure, it's accessable via %{HTTP_HOST} but that's the extent of it, along with every other server variable. Fair enough, you could think it may be an issue but looking into it would quickly prove that's not the case.

    No offense intended but you really can't constantly continue to try and pass off a completely inaccurate statement as fact simply because you don't know the real answer. I'm sure I've even pointed out this localhost misunderstanding before once or twice but clearly to no avail.

    @ferret, have you tried checking/setting AllowOverride to All? Other than that, I'm not sure - your .htaccess code looks fine to me.
     
    rodney88, May 5, 2007 IP
  4. the-ferret

    the-ferret Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Had amended apache conf file to look like

    <Directory />
    Options FollowSymLinks
    AllowOverride All
    </Directory>

    as it was set to None, however it is still failing with the same error. Any other ideas

    cheers
     
    the-ferret, May 5, 2007 IP
  5. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Is that the only instance of AllowOverride? At least on my XAMP setup, the standard httpd.conf first specifies options for the root domain in the <Directory /> tags, then later has it repeated for the webroot, i.e. <Directory D:/xampp/htdocs/>
     
    rodney88, May 5, 2007 IP
  6. the-ferret

    the-ferret Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    No, missed the others, have now amended that too but still not working :confused:

    <Directory "C:/Program Files/Apache Group/Apache2/htdocs">

    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important. Please see
    # http://httpd.apache.org/docs-2.0/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    # Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

    </Directory>
     
    the-ferret, May 5, 2007 IP