For a simple php site, I want to have friendly URLs. So I would like my urls to look like:
Which points to:
http://mysite.com/page.php?id=123
And this works! But If I point to a file that isn’t on the server, apache spikes, and I have to force Apache to quit (developing locally with MAMP, for right now).
Here’s my .htaccess file. Any ideas?
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([^/=]+)/?([^/]*)/?$ $1.php?id=$2 [N,QSA]
ErrorDocument 404 /404.php
Just reverse the order of your two rules and use the L flag instead of N: