I’m using mod_rewrite to transform:
www.example.com/view.php?ID=1234
into
www.example.com/1234
using the following rule:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^([A-Za-z0-9-]+)?$ view.php?ID=$1 [L]
which works, correctly rewriting the URL. However, when I go to the website itself at:
www.example.com
it tries to rewrite that URL as well, displaying the view.php page as if ID had been left blank, rather than displaying index.php like it normally would.
How would I go about fixing this?
Remove the questionmark from your RewriteRule. This makes the preceeding expression optional.