www.webdeveloper.com
Results 1 to 2 of 2

Thread: mod_rewrite woes

  1. #1
    Join Date
    Nov 2008
    Posts
    2,477

    mod_rewrite woes

    I have a URl I'm trying to rewrite. The URL looks like this:

    http://www.domain.com/photo-gallery/country/keyword/46

    I want to simply take everything after photo-gallery/ and pass it to a php script. However rewrite does not seem to like the hyphen.

    Here's some things i've tried:

    Code:
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteBase /
        RewriteRule ^photo-gallery/(.*)$ photo-gallery.php?req=$1    [L]
        RewriteRule ^photo\-gallery/(.*)$ photo-gallery.php?req=$1    [L]
        RewriteRule ^photo.gallery/(.*)$ photo-gallery.php?req=$1    [L]
     </IfModule>
    None of which work. However as soon as I change the url to photo_gallery (ie replace the hyphen with an underscore) and adjust the rules accordingly it works fine.

    Any ideas?

  2. #2
    Join Date
    Nov 2008
    Posts
    2,477
    I've done some testing and this issue is only apparent when running apache under OSX. On linux and windows boxes the exact same file produces the desired effect. Does anyone have any idea why this may not be working on my mac?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles