重写规则导致“错误请求”当放置在虚拟主机文件中时
我的客户网络主机坚持将站点的重写规则放入虚拟主机文件中,但这会导致错误“错误请求”。尽管当我在本地服务器和其他类似站点上的 .htaccess 中放置相同的规则时,它运行得很好。规则如下:
RewriteRule ^api/ index_rest.php [L]
RewriteRule ^index_rest.php - [L]
RewriteRule ^([^/]+/)?content/treemenu.* index_treemenu.php [L]
RewriteRule ^var/([^/]+/)?storage/images(-versioned)?/.* - [L]
RewriteRule ^var/([^/]+/)?cache/(texttoimage|public)/.* - [L]
RewriteRule ^design/[^/]+/(stylesheets|images|javascript)/.* - [L]
RewriteRule ^share/icons/.* - [L]
RewriteRule ^extension/[^/]+/design/[^/]+/(stylesheets|flash|images|lib|javascripts?)/.* - [L]
RewriteRule ^packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^var/storage/packages/.* - [L]
RewriteRule ^favicon.ico - [L]
RewriteRule ^design/standard/images/favicon.ico - [L]
RewriteRule ^robots.txt - [L]
RewriteRule ^w3c/p3p.xml - [L]
RewriteRule .* index.php
我的主机给了我一个错误日志,该日志位于位于此处,但我无法识别问题。非常感谢任何帮助。
My clients webhost insists on placing the Rewrite-rules for the site in the virtual host file, but this causes the error "Bad request". Although when I place the same rules in a .htaccess on my local server, and other similar sites, it works perfectly. Here are the rules:
RewriteRule ^api/ index_rest.php [L]
RewriteRule ^index_rest.php - [L]
RewriteRule ^([^/]+/)?content/treemenu.* index_treemenu.php [L]
RewriteRule ^var/([^/]+/)?storage/images(-versioned)?/.* - [L]
RewriteRule ^var/([^/]+/)?cache/(texttoimage|public)/.* - [L]
RewriteRule ^design/[^/]+/(stylesheets|images|javascript)/.* - [L]
RewriteRule ^share/icons/.* - [L]
RewriteRule ^extension/[^/]+/design/[^/]+/(stylesheets|flash|images|lib|javascripts?)/.* - [L]
RewriteRule ^packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^var/storage/packages/.* - [L]
RewriteRule ^favicon.ico - [L]
RewriteRule ^design/standard/images/favicon.ico - [L]
RewriteRule ^robots.txt - [L]
RewriteRule ^w3c/p3p.xml - [L]
RewriteRule .* index.php
My host has given me an error log which is located here, but I cannot identify the problem. Any help is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 VirtualHost 上下文中使用时需要使用前导斜杠。
所以
^...
必须是^/...
You need to use leading slashes when using in the VirtualHost context.
So
^...
must be^/...