我想讓我的網址乾淨。下面是我想做的事:
骯髒的網址:www.site.com/index.php?page=products
清潔網址:www.site.com/products/
使用Apache mod_rewrite時<a>標記中href屬性的正確形式是什麼?
對於這一點,我寫在.htaccess文件這些代碼:
Options +FollowSymLinks
RewriteEngine On
RewriteBase/
RewriteRule ^([^/]*)/$ /index.php?page=$1
但每當我點擊鏈接在我的項目中,我重定向到localhost
頁面。鏈接是這種形式:
<a href="products">Products</a>
我認爲這可能與href
值。
什麼是href
價值的正確形式? href="product"
,href="/product/"
等。 ?
謝謝@尼克爲您提供寶貴的答案。請告訴我,對於我所說的,「RewriteBase /」有沒有任何作用? –
正如我把'?'標記,當我想要午餐網站時,我重定向到本地主機:( –