[英]Htaccess Rewrite Rule for showing title & category id in url
我想在網址中顯示我的標題,以及像這樣的類別和子類別。
http://www.phpshiksha.com/php-tutorials-set-time-zone/22-14
我希望這將調用頁面名稱default.php或其他什么,我將能夠在頁面上獲得類別ID 22和子類別ID 14。我知道這將是什么.htaccess rewtite規則。
我將感謝你的幫助。
這應該讓你開始
RewriteEngine on
RewriteRule ^([0-9A-Za-z\-]+)/([0-9]+)-([0-9]+) main.php?title=$1&cat=$2&subcat=$3
它應該產生一個$ _GET數組,如下所示
array(3) {
["title"]=>
string(27) "php-tutorials-set-time-zone"
["cat"]=>
string(2) "22"
["subcat"]=>
string(2) "14"
}
phpshiksha.com/index.php到phpshiksha.com/home的規則
RewriteRule index.php home
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.