【问题标题】:.htaccess redirect from old folder name to new folder name.htaccess 从旧文件夹名称重定向到新文件夹名称
【发布时间】:2013-06-10 11:49:53
【问题描述】:

我有 .htaccess 规则,它将一个文件夹名称重写为新的 -

RewriteEngine on
RewriteRule ^home/(.*) profile/$1

网址www.domian.com/home/abc.htmlwww.domain.com/profile/abc.html 都符合此规则。如果用户直接在浏览器中输入...home/abc.html,有没有办法在不更改锚标签的情况下自动从.../home/abc.html重定向到../profile/abc.html

任何帮助表示赞赏。 谢谢。

【问题讨论】:

    标签: .htaccess joomla


    【解决方案1】:

    尝试将您的规则更改为:

    RewriteRule ^home/(.*) profile/$1 [L,R=301]
    

    在规则中添加[L,R=301] 标志使得请求被重定向而不是内部重写。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-26
      • 2015-10-09
      • 2014-11-24
      相关资源
      最近更新 更多