【问题标题】:mod_rewrite .htaccess from subfoder子文件夹的 mod_rewrite .htaccess
【发布时间】:2015-12-14 14:09:20
【问题描述】:

我有这个网站结构

localhost/
    - administrator/
      - auth/
         - login.php
      - index.php

    - website/
      - index.php

index.php 我有一个请求localhost/auth/login。 我的需求是:当用户向localhost/auth/login路径发出请求时,必须将请求重定向到/administrator/auth/login.php

我试过这段代码,但它不起作用:

RedirectMatch 301 /auth/login(.*) /administration/auth/login.php/$1

【问题讨论】:

    标签: php apache .htaccess mod-rewrite redirect


    【解决方案1】:

    在您的正则表达式中使用锚点。在站点根目录 .htaccess 中尝试此规则:

    RedirectMatch 301 ^/auth/login(.*)$ /administration/auth/login.php$1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-16
      • 2011-08-19
      • 1970-01-01
      • 1970-01-01
      • 2018-01-10
      • 1970-01-01
      • 2012-09-14
      • 1970-01-01
      相关资源
      最近更新 更多