[英]How Do You Get Variable Between Final Dash and File Extension Using Mod_Rewrite?
[英]Using mod_rewrite with a single GET variable
我正在嘗試重寫網址,例如:
example.com/var?id=0&blah=foo
至
example.com/?test=var&id=0&blah=foo
AddHandler application/x-httpd-php5s .php RewriteEngine on RewriteRule ^([A-Za-z0-9-]+)/?$ ?api_call=$1 [L,QSA]
它將var
重寫為?test=var
但其余的get變量則保留。
嘗試以下規則:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-]+)/?$ ?api_call=$1 [L,QSA]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.