[英]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.