菜單代碼:現代重寫 - htaccess的
<a href="/category/<?=$cat_name['id']?>/<?=simpleURI($cat_name['catname'])?>/" title="<?=ucfirst($cat_name['catname']); ?>">Level 1</a>
<a href="/category/<?=$subcat_name['id']?>/<?=simpleURI($cat_name['catname'])?>/<?=simpleURI($subcat_name['catname'])?>/" title="<?=ucfirst($subcat_name['catname']); ?>">Level 2</a>
<a href="/category/<?=$subcat_name1['id']?>/<?=simpleURI($cat_name['catname'])?>/<?=simpleURI($subcat_name['catname'])?>/<?=simpleURI($subcat_name1['catname'])?>/" title="<?=ucfirst($subcat_name1['catname']); ?>">Level 3</a>
<a href="/category/<?=$subcat_name2['id']?>/<?=simpleURI($cat_name['catname'])?>/<?=simpleURI($subcat_name['catname'])?>/<?=simpleURI($subcat_name1['catname'])?>`/<?=simpleURI($subcat_name2['catname'])?>/" title="<?=ucfirst($subcat_name2['catname']); ?>">Level 4</a>
當前國防部工作罰款/category/18/cat-name-level/cat-name-level2/
這裏是我的.htaccess:
RewriteRule ^category/([0-9]+)(?:/([^/]+)(?:/([^/]+))?)(?:/([^/]+)(?:/([^/]+))?)?/$ ./category.php?pid=$1 [QSA,L]
的問題,我們可以在ID後輸入任何內容:
/category/18/yehahh/jsidfd/
/category/18/jkasjksd/dhgidg/ondsg/djgn/
如何解決呢?
我不知道爲什麼這是一個問題。是否因爲querystring被傳遞爲q = 18/fghdfljkghdfl? – 2009-07-17 14:56:15