.htaccess文件夹重定向

.htaccess文件夹重定向,.htaccess,.htaccess,我尝试在我的文件夹中进行重定向: Redirect /promotion/ /newpromotion Redirect /promotion/first/ /new/first/ 现在如果我尝试打开http://mysite.com/promotion/firstI打开http://mysite.com/newpromotion/new/first但我需要http://mysite.com/new/first 我怎样才能修好它 UPD: 这很疯狂,但我做到了: Redirect /pr

我尝试在我的文件夹中进行重定向:

Redirect /promotion/ /newpromotion
Redirect /promotion/first/ /new/first/
现在如果我尝试打开
http://mysite.com/promotion/first
I打开
http://mysite.com/newpromotion/new/first
但我需要
http://mysite.com/new/first

我怎样才能修好它

UPD: 这很疯狂,但我做到了:

   Redirect /promotion/ /newpromotion
   Redirect /promotion/first/ /new/first/
   Redirect /newpromotion/new/first /new/first/
解决方案: 需要反转2个指令:

Redirect /promotion/first /new/first
Redirect /promotion /newpromotion
Redirect /promotion/first /new/first
Redirect /promotion /newpromotion
试一试


重定向/升级/第一次//新建/第一次/ 重定向/升级//新建升级

更详细的应该放在第一位

-----编辑------

试试这个:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteRule ^/promotion/first/$ /new/first/ [L]
RewriteRule ^/promotion/$ /newpromotion/ [L]
试一试


重定向/升级/第一次//新建/第一次/ 重定向/升级//新建升级

更详细的应该放在第一位

-----编辑------

试试这个:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteRule ^/promotion/first/$ /new/first/ [L]
RewriteRule ^/promotion/$ /newpromotion/ [L]

重定向
指令一起连接到路径节点,因此当您有:

Redirect /promotion/ /newpromotion
这意味着任何以
/promotion/
开头的都会被重定向到
/newpromotion/
。e、 g:

  • /promotion/
    ->
    /newpromotion/
  • /promotion/foo.html
    ->
    /newpromotion/foo.html
  • /promotion/first/
    ->
    /newpromotion/first/
您只需反转2个指令:

Redirect /promotion/first /new/first
Redirect /promotion /newpromotion
Redirect /promotion/first /new/first
Redirect /promotion /newpromotion

重定向
指令一起连接到路径节点,因此当您有:

Redirect /promotion/ /newpromotion
这意味着任何以
/promotion/
开头的都会被重定向到
/newpromotion/
。e、 g:

  • /promotion/
    ->
    /newpromotion/
  • /promotion/foo.html
    ->
    /newpromotion/foo.html
  • /promotion/first/
    ->
    /newpromotion/first/
您只需反转2个指令:

Redirect /promotion/first /new/first
Redirect /promotion /newpromotion
Redirect /promotion/first /new/first
Redirect /promotion /newpromotion

@NickBrit,要么您有其他冲突的规则或重定向,要么您没有正确描述问题。@NickBrit,要么您有其他冲突的规则或重定向,或者您没有正确描述问题。Redirect/promotion/first//new/first/Redirect/promotion//newpromotion-workRedirect/promotion/first//new/first/Redirect/promotion//newpromotion-work