2

我有.htaccess文件:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^somedomain.com [NC]
RewriteRule ^(.*)$ http://www.somedomain.com/$1 [R=301,NC]

RewriteRule ^r/(.*)$ index.php?rid=$1 [NC]

但是当我请求 URL likewww.somedomain.com/r/123并显示 URL like时,最后一个条件在浏览器中执行重定向www.somedomain.com/index.php?rid=123。但我需要在不更改 URL 的情况下调用此脚本。

怎么了?

4

1 回答 1

3

您使用了R=301Try to use L,如下所示:

RewriteCond %{HTTP_HOST} ^somedomain.com [L]
RewriteRule ^(.*)$ http://www.somedomain.com/$1 [L]

RewriteRule ^r/(.*)$ index.php?rid=$1 [L]
于 2012-11-02T12:01:35.230 回答