【发布时间】:2013-03-23 14:02:18
【问题描述】:
当用户请求http://www.hostname.com/first/api/getlink 时,我必须重定向到http://www.hostname.com/first/api.php?type=link。
所以我尝试了以下
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.hostname\.com\/first$
RewriteBase /
RewriteRule ^api/getlink$ \/api.php?type=link [L]
在.htaccess 文件中并放在first/ 文件夹中。我无法获得正确的重定向。但我收到404 error。有人可以指导我吗?提前致谢。
【问题讨论】:
-
动态字符串有哪些?
-
更新了!你现在可以检查一下吗?
-
RewriteRule必须在RewriteCond旁边。而且您的主机名正则表达式是错误的,因为它包含路径
标签: php .htaccess url-rewriting url-redirection