【问题标题】:apache .htaccess rewritecond problems catching all admin requestsapache .htaccess rewritecond 捕获所有管理请求的问题
【发布时间】:2014-03-07 06:28:38
【问题描述】:

试图让我的 .htaccess 条件工作,但它们似乎无法正常工作,特别是我要删除 /admin/ 目录的第二组 - 它一直被困在第一组条件中

# If the request is either /admin/ or /admin/index.html, rewrite to just admin.html
# http://foo.com/admin/
# http://foo.com/admin/index.html
RewriteCond %{REQUEST_URI} ^/admin/$ [OR]
RewriteCond %{REQUEST_URI} ^/admin/index\.html$
RewriteRule ^ admin.html [L]

# if the request starts w/ /admin/, then remove the /admin folder and continue processing
# http://foo.com/admin/bar/baz.css
RewriteCond %{REQUEST_URI} ^/admin/.*$
RewriteRule ^/admin/(.*)$ /$1

# if any resource is not a directory or file, then rewrite to the index.html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [L]

这是一个应该如何工作的映射

group one

group two

group three

【问题讨论】:

    标签: apache .htaccess mod-rewrite


    【解决方案1】:

    为什么不消除第一组规则,让第二组处理所有管理员重定向。然后在 Apache 中将 admin.html 设置为默认文件?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多