Reputation: 419
I'm trying to rewrite URLs where there are a few fixed page URLs, and everything else gets rewritten. Here's what I need:
domain.com/
domain.com/about
domain.com/* (anything else)
Should redirect to:
/index.php
/about.php
/display.php?id=*
No idea how to do it. Can anyone help me out?
Upvotes: 0
Views: 36
Reputation: 419
Solved! This works:
RewriteRule ^about$ /about.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /display.php?id=$1 [L]
The index page is handled by using (.+) instead of (.*), which lets the site config forward the request normally to index.php so .htaccess doesn't try and forward it to display.php.
Upvotes: 2