【发布时间】:2013-03-15 22:48:15
【问题描述】:
我一直在尝试用 htaccess 文件重写我的 URL。 我的项目使用我的 index.php 作为它的基本控制器。 我使用获取值“naam”从数据库中获取页面。
示例: localhost/YourDesigns/YDCMS/index.php?naam=home(显示主页) localhost/YourDesigns/YDCMS/index.php?naam=about(这显示了关于页面)
现在我想重写要显示的 URLS: localhost/YourDesigns/YDCMS/home(显示主页) localhost/YourDesigns/YDCMS/about(这显示了关于页面)
我自己做了一些 htaccess 的东西,我已经成功地从 url 中删除了“index.php”,但“naam”仍然存在。
如何删除它? 这是我当前的 htaccess 文件:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /YourDesigns/YDCMS/index.php?naam=/$1 [L]
提前致谢:)
【问题讨论】:
标签: php .htaccess url url-rewriting