Apache on OSX is adding a php extension within url, breaking mod_rewrite

Discussion in 'Apache' started by d_clef, Sep 23, 2013.

  1. #1
    Hi there.

    Hopefully this is a simple one, however I would appreciate help.

    I am setting up my work environment on OSX (a new macbook), and my previous setup is a Windows 7 PC. I've found that mod_rewrite is no longer working, and have found some clues why:

    Typically, I want to take a URL such as

    http://localhost/mysite/catalog/the_hobbit
    Code (markup):
    which by mod_rewrite will get turned into
    http://localhost/mysite/catalog.php?link=the_hobbit
    Code (markup):
    so far so good, and this works fine on the Windows PC.

    However, I believe Apache on my macbook has something configured differently, as since it knows about the file catalog.php, it appears to update the URL to:
    http://localhost/mysite/catalog.php/the_hobbit
    Code (markup):
    BEFORE the mod_rewrite happens. Hence the mod_rewrite fails.

    I am basing this on having enabled RewriteLog in httpd.conf.

    Any help most appreciated. Thanks!

    -David

    *edit - found the fix. Per stackOverflow - turns out adding the following to the .htaccess file:
    Options -MultiViews
    stops this behavior.

    Source:
    http://stackoverflow.com/questions/969508/mod-rewrite-adding-unwanted-file-extension
     
    Last edited: Sep 23, 2013
    d_clef, Sep 23, 2013 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    are you using any kind of framework in your application?
    i think this is a controller issue
     
    bartolay13, Oct 17, 2013 IP