[英]htaccess rewrite url rule trouble detect $_GET isset
RewriteEngine On
RewriteRule ^about/([^/.]+)/?$ about.php?id=$1 [L,QSA]
我的網頁對網址使用htaccess重寫規則
/about/33
該頁面需要$ _GET ['id']來獲取數據庫
但是我很難檢測到GET變量isset
if(isset($_GET['id'])){fetch data...}else{header("location:...");}
如果用戶只輸入/about/
而沒有$GET['id']
,則找不到頁面,而是運行header(“ location”);
反正解決這個問題?
嘗試這個:
RewriteRule ^about/([^/.]*)/?$ about.php?id=$1 [L,QSA]
用*代替+
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.