“Two Way” Rewrite

前端 未结 1 1765
生来不讨喜
生来不讨喜 2020-12-22 01:46

So, I\'m trying to accomplish this:

We have a URL /brand/new-inventory.php. This is a physical file within our site. What I\'d like it to be is /b

相关标签:
1条回答
  • 2020-12-22 02:33

    Have it this way:

    RewriteCond %{THE_REQUEST} \s/+brand/new-inventory\.php[/\s?] [NC]
    RewriteRule ^ /brand/new [R=302,L]
    
    RewriteRule ^brand/new$ /brand/new-inventory.php [L,NC]
    

    Difference is use of %{THE_REQUEST} that represents original request received by Apache from your browser. Value of this variable doesn't change with application of other rewrite rules.

    0 讨论(0)
提交回复
热议问题