[英]php url without extension
我的主題與已棄用的主題不同,我需要的是將字符串作為URL而不顯示PHP文件名。 我有點擊的項目和去edit.php頁面我試圖獲得一個點擊的字符串作為URL。
例如,如果我點擊'abc',我想轉到頁面edit.php,瀏覽器顯示:
http://localhost/abc
不要
http://localhost/edit.php?item=abc
它類似於Symfony中的路由。
以下是您上面非常具體示例的示例.htaccess文件:
# turn on rewriting
RewriteEngine on
# check that the request isn't actually a real file (e.g. an image)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# redirect requests for BLAH to /edit.php?item=BLAH
RewriteRule ^(.*)$ /edit.php?item=$1 [NC,L]
以下是您需要的其他文檔http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.