I am trying to create a rewrite rule which will detect numbers only and forward them accordingly. I want the rewrite rule to be ignored if anything but numbers appears.
/index.php
- OK/
- OK/42365
- rewrites toview.php?id=42365
What I have so far:
RewriteEngine on
RewriteRule ^([0-9]+)?$ view.php?id=$1 [L]
Remove the
?
from the end of the([0-9]+)
group, which makes it optional. You must have numbers for the rewrite to occur: