【发布时间】:2015-04-18 01:56:38
【问题描述】:
(对不起,我的英语不好。我来自德国)
我正在尝试为 Imageviewer 获取漂亮的 URL。
我刚刚获得了子域的 htaccess-Code
RewriteEngine on
RewriteCond %{HTTP_HOST} i.domain.de$
RewriteCond %{REQUEST_URI} !^/imageviewer
RewriteRule ^(.*)$ /imageviewer/$1 [L]
这就是我希望看到的结果。如果我导航到 i.domain.de,浏览器会显示正确的 URL,并且会显示 /imageviewer/ 中的 index.php。
但我想要漂亮的网址。现在我有带有 i.domain.de/?id=2ntxfi 或 i.domain.de/index.php?id=2ntxfi 等参数的 URL 但我希望它是 i.domain.de/2ntxfi/ PHP 仍应获取 $_GET['id'] 参数。
我怎样才能做到这一点?
旁注:我有一个虚拟服务器。因此,如果需要,我可以安装 Apache 扩展。
【问题讨论】:
标签: php .htaccess url mod-rewrite redirect