本文介紹了htaccess mod_rewrite url 的一部分到 GET 變量的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我有一些這樣的網址:
http://plutov.by/post/cubique_zf_jquery
http://plutov.by/post/mysql_useful_queries
如何借助 Apache mod_rewrite 打開下一頁?
How can I with help of Apache mod_rewrite open the next pages?
http://plutov.by/post/main?title=cubique_zf_jquery
http://plutov.by/post/main?title=mysql_useful_queries
此外,這個新的重寫規則是否適用于一個入口點重寫"?
Also, will be this new rewrite rule work with "one entry point rewriting"?
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
謝謝.
推薦答案
要使新的重寫規則與一個入口點重寫"配合使用,請讓您的 rewriteRules
像這樣:
To make the new rewrite rule work with "one entry point rewriting", have your rewriteRules
like this:
當您添加新的查詢字符串時,QSA
標志是強制.
The QSA
flag is mandatory as you are adding a new query string.
RewriteEngine On
RewriteRule ^(post)/([wd-]+)/?$ $1/main?title=$2 [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . index.php [L]
- 標記
QSA
Apache文檔. !-l
檢查請求的 URI 是否不是符號墨水.- Flag
QSA
Apache Docs. !-l
checks that the requested URI is not a symbolic ink.
這篇關于htaccess mod_rewrite url 的一部分到 GET 變量的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!