這裏是鏈接編輯表單:如何使用.htaccess從網址隱藏查詢字符串?
<a class="btn btn-success btn-xs" href="<?php echo SITE_URL."update?z=$zone_id" ?>" >Edit</a>
現在update.php頁面的URL是像波紋管:
http://localhost/aponit/dev/update?z=55
現在我想URL應該喜歡就好波紋管:
http://localhost/aponit/dev/update/55
我該如何使用.htaccess來做到這一點?
注:使用當前的.htaccess規則,我從URL中隱藏剛剛.php
擴展
我目前的.htaccess文件
ErrorDocument 404 /not-found.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
RewriteRule ^aponit/dev/update/([0-9]+) aponit/dev/update.php?z=$1 [L]
那麼我應該改變鏈接像這樣︰update/$ zone_id? –
你的意思是這樣的網址:http:// localhost/update/$ zone_id。 –
不,url應該是:http:// localhost/aponit/dev/update/55,所以我應該改變我現有的編輯鏈接代碼從" >Edit到" >Edit –