apache - Mod_rewrite 忽略条件
问题描述
Apache 似乎忽略了以下条件。我试图确保如果请求 URI 中包含站点地图一词,则不执行重写规则。例子:
http://www.mysites.com/sitemap或http://www.mysites.com/sitemap/users/sitemap1.gz
<IfModule mod_proxy_http.c>
RewriteCond %{HTTP_USER_AGENT} googlebot|google-structured-data-testing-tool|semrushbot|applebot|bingbot|yandex|baiduspider|ahrefsbot|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|vkShare|W3C_Validator|whatsapp [NC,OR]
RewriteCond %{QUERY_STRING} _escaped_fragment_
RewriteCond %{REQUEST_URI} ^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent|\.ttf|\.woff|\.svg))
RewriteCond %{REQUEST_URI} !^/sitemap(/|$)
RewriteRule ^(index\.html|index\.php)?(.*) https://service.prerender.io/%{REQUEST_SCHEME}://%{HTTP_HOST}/$2 [P,L]
</IfModule>
Apache 似乎只是忽略了这一点并执行代理请求。有任何想法吗?
解决方案
好吧,我的坏:
RewriteCond %{REQUEST_URI} !^/sitemap(/|$)
本来应该:
RewriteCond %{REQUEST_URI} !^sitemap
推荐阅读
- spring-boot - Envers,导航多对多关系
- python - PythonAnywhere 的管理页面中未显示新模型字段
- azure-object-anchors - AOA 对象跟踪背后的粗略概念是什么?
- servlets - ServletFileUpload#parseRequest(request) 中的错误与 tomcat 10
- android - Android Studio MPAndroidChart 饼图未显示
- flutter - 颤振:下拉问题
- firebase - firebase oauth2 accessToken 没用
- mysql - node-hapi 代码部署在 aws 实例(micro t2)上 - 一段时间后,swagger 响应为空
- ruby-on-rails-3 - 如何使用 .verify 验证 jwt 令牌而不是 rails 中的 .decode 方法?
- django - MariaDB 在 Django 中替换 MySQL