.htaccess htaccess用变量重写

.htaccess htaccess用变量重写,.htaccess,variables,rewrite,rule,.htaccess,Variables,Rewrite,Rule,我使用的是joomla,我试图在htaccess中传递一个变量,我必须重写这个地址: http:// site.com/en/one/userprofile/avatar3 到avatar3可以是每个用户名 http:// site.com/en/two/userprofile/avatar3 我试过这样做,但不起作用 RewriteEngine on RewriteRule ^/en/one/userprofile/(.*)$ http:// site.com/en/two/userpro

我使用的是joomla,我试图在htaccess中传递一个变量,我必须重写这个地址:

http:// site.com/en/one/userprofile/avatar3
到avatar3可以是每个用户名

http:// site.com/en/two/userprofile/avatar3
我试过这样做,但不起作用

RewriteEngine on
RewriteRule ^/en/one/userprofile/(.*)$ http:// site.com/en/two/userprofile/$1 [R=301,NC,L]
您可以尝试:

RewriteEngine on
RewriteRule ^en/one/userprofile/(.*)$ /en/two/userprofile/$1 [R=301,NC,L]
  • .htaccess
    符合目录指令,Apache从
    RewriteRule
    URI模式中删除当前目录路径(因此是前导斜杠)