[英]htaccess redirect all url to same location except one starting with staging
我想将所有url重定向到一个静态页面,但其中包含暂存页面
例如
base_url应该登陆/static/index.html
但:
base_url / anything应该重定向到/ f / w / anything
RewriteCond %{REQUEST_URI} !^staging
RewriteRule ^(.*) static/index.html [L]
您可以在RewriteRule
本身中使用否定:
RewriteRule !^staging static/index.html [L,NC]
btw RewriteCond %{REQUEST_URI}
应以斜杠开头,因此您的条件应为:
RewriteCond %{REQUEST_URI} !^/staging
更新:根据已编辑的问题,您可以执行以下操作:
RewriteEngine on
# landing page
RewriteRule ^/?$ static/index.html [L]
# other URLs
RewriteRule !^f/w/ f/w%{REQUEST_URI} [L,NC]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.