Why won't this Apache modrewrite RewriteRule work?

Posted by Jason Rhodes on Stack Overflow See other posts from Stack Overflow or by Jason Rhodes
Published on 2009-11-30T01:28:37Z Indexed on 2010/03/13 12:05 UTC
Read the original article Hit count: 731

Filed under:

I'm trying to get Apache mod rewrite to work on my local machine. I'm running OSX with PHP 5 and the Apache mod rewrite module is enabled.

I have a directory called localhost/~Jason/hfh/admin with various PHP includes called based on a $_GET variable. I want to let users type (in theory)


and have that URL stay in the address bar, while what gets displayed is



I've created a .htaccess file that sits in the /hfh directory. Inside, I've put this mod rewrite text:

RewriteEngine On
RewriteRule ^admin/([^/.]+)/?$ admin/?admin=$1 [L]

When I go to the browser and type


I get a "Problem loading page" error, and Firefox says, "Oops. Firefox can't load this page for some reason."

Can anyone help me figure this out? I have such a hard time with regex and mod rewrite...

© Stack Overflow or respective owner

Related posts about mod-rewrite

Related posts about apache