HTAccess LocationMatch Server Error

断了今生、忘了曾经 提交于 2020-01-03 14:02:05

问题


I'm trying to use this .htaccess to change the RewriteBase if the location is local or live server.

Options +FollowSymlinks
RewriteEngine on

<LocationMatch "^/(bbtsrv02)/$">
    #RewriteBase /beta/admin/
</LocationMatch>

RewriteCond %{REQUEST_URI} !index.php$
RewriteCond %{REQUEST_URI} !css/(.*)\.
RewriteCond %{REQUEST_URI} !img/(.*)\.
RewriteCond %{REQUEST_URI} !incs/(.*)\.
RewriteCond %{REQUEST_URI} !js/(.*)\.
RewriteCond %{REQUEST_URI} !upload/(.*)\.
RewriteCond %{REQUEST_URI} !widget/(.*)\.
RewriteRule ^(.*) index.php?_pd=$1 [NC,L]

As soon as I remove the LocationMatch the whole thing starts working again. I only need to change the RewriteBase for live testing.


回答1:


<LocationMatch> directive CANNOT be used in .htaccess file -- only in server config or virtual host context.

http://httpd.apache.org/docs/current/mod/core.html#locationmatch



来源:https://stackoverflow.com/questions/6663611/htaccess-locationmatch-server-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!