【发布时间】:2014-08-25 08:51:29
【问题描述】:
使用.htaccess RewriteEngine 规则获取php中的值
我正在使用以下规则
RewriteEngine On
RewriteRule ^([^/]*)$ page.php?title=$1 [L]
这意味着它将创建一个类似视图的页面
(即)
www.mywebsite.com/contact
www.mywebsite.com/blog
但是我如何获取在 url 中传递的值并使用 Get 方法 echo "Page content is ".$_GET['title']; 将其显示在页面内
当我在像 www.mywebsite.com/view 这样的 url 中传递值时,
它只是显示>页面内容是page.php
我在做什么错误,我该如何解决?
【问题讨论】:
标签: php regex apache .htaccess mod-rewrite