0
試圖讓我的.htaccess條件工作,但他們似乎並沒有正常工作,特別是第二組,我去除/ admin /目錄 - 它保持陷入在第一組條件apache .htaccess rewritecond問題捕獲所有管理請求
# 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
- http://foo.com/admin - >http://foo.com/admin.html
- http://foo.com/admin/index.html - >http://foo.com/admin.html
group two
- http://foo.com/admin/bar/baz.css - >http://foo.com/bar/baz.css
- http://foo.com/admin/baz.css - >http://foo.com/baz.css
group three
- http://foo.com/bar/baz.css - >http://foo.com/bar/baz.css(假設/bar/baz.css存在)
- http://foo.com/bar/baz.css - >http://foo.com/index.html(假設/bar/baz.css不存在)