Reputation: 2564
RewriteEngine On
RewriteRule ^about/([^/.]+)/?$ about.php?id=$1 [L,QSA]
I have a page use htaccess rewrite rule for url
/about/33
the page require $_GET['id'] to fetch db
however i have trouble to detect GET variable isset
if(isset($_GET['id'])){fetch data...}else{header("location:...");}
if user only enter /about/
without $GET['id']
the page will not found instead run header("location");
is anyway to solve this?
Upvotes: 2
Views: 677
Reputation: 2485
try this:
RewriteRule ^about/([^/.]*)/?$ about.php?id=$1 [L,QSA]
Put * instead of +
Upvotes: 3