[英]ReWrite rule for long URL
我正在遵循重寫規則廣告
RewriteEngine On
RewriteCond ${REQUEST_URI} ^.+$
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|js|css|swf|php|ico|txt|pdf|xml)$ [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]
RewriteRule ^(.*)/(.*)/?$ index.php?rt=$1/$2 [L]
RewriteRule ^(.*)/(.*)/(.*)/?$ index.php?rt=$1/$2/$3 [L]
如果網址是http://www.example.com/manage/ne/new?query=123 means
,我將使用php中的“ $ _GET”獲取通過URL傳遞的“查詢”的值。
它會像` http://www.example.com/index.php?rt=manage/ne/new
但我的需要是http://www.example.com/index.php?rt=manage/ne/new&query=123
有誰能幫助我解決有關Htacces的問題。
您需要在底部2條規則中使用QSA
標志:
RewriteRule ^([^/]+)/(.+)/?$ index.php?rt=$1/$2 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/(.+)/?$ index.php?rt=$1/$2/$3 [L,QSA]
QSA
(查詢字符串追加)標志在添加新參數時保留了現有查詢參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.