我有的.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如 www.somedomain.com/r/123
并告诉我像 WWW网址。 somedomain.com/index.php?rid=123
。但我需要调用此脚本,而不URL改变。
But last condition performs redirect in browser when I request URL like www.somedomain.com/r/123
and show me URL like www.somedomain.com/index.php?rid=123
. But I need call this script without URL change.
怎么了?
您使用了 R = 301
尝试使用→
就像下面这样:
You used the R=301
Try to use L
just like following:
RewriteCond %{HTTP_HOST} ^somedomain.com [L]
RewriteRule ^(.*)$ http://www.somedomain.com/$1 [L]
RewriteRule ^r/(.*)$ index.php?rid=$1 [L]