【发布时间】:2011-08-17 01:58:33
【问题描述】:
我目前正在框架上创建 CMS。我制作了我的 .htaccess 文件,如下所示:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z]+)/(.*)$ index.php?url=$1 [PT,L]
</IfModule>
我的问题是:
1) 我的页面可以通过正常的 MVC URL 访问: http://example.com/pages/view/{the-shorttag-of-the-page}
2) 我的页面也可以通过路由访问: http://example.com/p/{the-shorttag-of-the-page}
我真正需要实现的是我可以通过两种方式访问它: http://example.com/{the-shorttag-of-the-page} 或有语言支持 http://example.com/{lang}/{the-shorttag-of-the-page}
我的问题是我不想更改 mod_rewrite - 我宁愿在 PHP 中创建路由,但我找不到如何在没有的情况下路由到 PageController->view() 方法的解决方案条件中的静态字母(上例中的“p”)。
你明白我的问题吗? 你有什么建议可以引导我走向正确的方向吗?
【问题讨论】:
标签: php mod-rewrite url-routing multilingual seo