There's something really wrong about my .htaccess!

Discussion in 'Web Design and Development' started by FRKT, May 8, 2009.

  1. FRKT macrumors member

    Joined:
    Apr 24, 2009
    #1
    Hi there,

    I think my .htaccess file has gone haywire. I'm attempting to implement RewriteEngine (ie. mod_rewrite) locally, and while it works perfectly on my online server it's refusing to work on my Mac.

    Code:
    RewriteEngine on
    RewriteRule ^article/(.*)/([^/\.]+)/?$ article.php?id=$1 [NC,L]
    
    This should (and does) rewrite article/12/title-goes-here to article.php?id=12. Locally, though, it doesn't pass the variable and seems to have some really odd caching issues. I'm able to disable RewriteEngine or even delete the entire section and my web server still rewrites the URl (albeit continues to omit the ID). You think that's weird? How about this - restarting apache doesn't clear the cache, either. Yeah.

    Any ideas?
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Can you give some examples of what's going wrong. The rule there looks correct. Also make sure on your local setup that you have things turned on to allow using the .htaccess files.
     
  3. FRKT thread starter macrumors member

    Joined:
    Apr 24, 2009
    #3
    Thanks for your reply. I did explain what's going wrong - it's rewriting the URL but not passing the variable. There's also the caching issue. As it does rewrite the URL, Apache is reading the .htaccess file. ErrorDocuments also work.
     

Share This Page