【发布时间】:2015-07-09 09:13:47
【问题描述】:
我有 PHP url 用于显示每个页面的内容,例如:
类别:
articles
gallery
page
books
....
网址:
http://localhost/cms/load.php?page=articles&id=1&title=this-is-a-title.html&lang=ru
http://localhost/cms/load.php?page=page&id=10&title=this-is-a-page-title.html&lang=ru
在行动中,我需要像这样自动将 url 重写为 seo 友好的 url:
http://localhost/cms/ru/articles/1/this-is-a-title.html
http://localhost/cms/ru/page/10/this-is-a-page-title.html
加载.php
$page = isset($_GET['page']) ? safeGET($_GET['page']) : null;
$id = isset($_GET['id']) ? safeGET($_GET['id']) : null;
if ($page=='articles') { include 'article.php'; } elseif { ... }
我怎样才能用PHP 生成这个URL(没有mod-rewrite 的偏好)?!或.htaccess and PHP?
【问题讨论】:
标签: php .htaccess url mod-rewrite