Apache 重写规则总是重定向到错误的url

Apache 重写规则总是重定向到错误的url,apache,.htaccess,mod-rewrite,url-rewriting,url-rewrite-module,Apache,.htaccess,Mod Rewrite,Url Rewriting,Url Rewrite Module,大家好, 我需要重写到 我写过这样的规则: RewriteRule user/profile/(.*)/(.*) /user/profile/$2?profile_name=$1 [L,R=301] 当我在浏览器中放入类似的url时,它总是将我重定向到 我错过了什么 提前感谢您可以使用以下代码: # external redirect from actual URL to pretty one RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+user/pr

大家好,
我需要重写到

我写过这样的规则:

RewriteRule user/profile/(.*)/(.*) /user/profile/$2?profile_name=$1 [L,R=301]  
当我在浏览器中放入类似的url时,它总是将我重定向到

我错过了什么

提前感谢

您可以使用以下代码:

# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+user/profile/([^?]+)\?profile_name=([^\s&]+) [NC]
RewriteRule ^ /user/profile/%1/%2? [R=301,L]

# internal forward from pretty URL to actual one
RewriteRule ^user/profile/([^/]+)/([^/]*)/?$ /user/profile/$2?profile_name=$1 [L,NC,QSA]  

谢谢但同样的结果是:(你们在浏览器中输入了什么URL,是不是
http://mysite.com/user/profile/following?profile_name=MYNAME
?您能否在问题中发布完整的.htaccess?这将在内部成为
/user/profile/following?profile\u name=MYNAME
(浏览器中的URL不会更改)