我想在网址中显示我的标题以及类别&像这样的子类别。
http://www.phpshiksha.com/php-tutorials-set-time-zone/22-14
我希望这会调用页面名称default.php或其他什么,我将能够在页面上获取类别ID 22和子类别ID 14.可能我知道.htaccess rewtite规则是什么。
感谢您的帮助。
答案 0 :(得分:2)
这应该让你入门
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"
}
答案 1 :(得分:0)
phpshiksha.com/index.php到phpshiksha.com/home
的规则RewriteRule index.php home