我在新服务器上安装了我的开发站点(dev.domain.co.uk),准备启动了。但是,在我们准备好之前,已将实时域指向新服务器。因此,我需要向www.domain.co.uk(包括www.domain.co.uk/cms/login等子页面)显示所有流量的保留页面,但允许开发流量。最后,开发站点受密码保护。
这是我的.htaccess ......
Options +FollowSymlinks
RewriteEngine On
# All traffic to www.domain.co.uk should go to the holding page
RewriteCond %{HTTP_HOST} ^www\.domain\.co.uk [NC]
RewriteRule ^(.*)$ public/holding.html$1 [L]
# Dev traffic to dev.domain.co.uk...
# Rewrite to 'public' folder for Laravel
RewriteCond %{HTTP_HOST} ^dev.domain.co.uk$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) public/$1 [L]
# Password protect dev.domain.co.uk
SetEnvIf Host dev.domain.co.uk passreq
AuthType Basic
AuthName "domain.co.uk"
AuthUserFile "/home/folder/.htpasswds/public_html/passwd"
Require valid-user
Order allow,deny
Allow from all
Deny from env=passreq
Satisfy any
除了子页面(如www.domain.co.uk/cms/login等)之外,这是有效的 - 我做错了什么?
答案 0 :(得分:1)
由于您希望为实时网站显示固定的静态页面,因此请勿捕获URI模式并在.html
之后附加它。
将您的第一条规则保留为:
# All traffic to www.domain.co.uk should go to the holding page
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.co\.uk$ [NC]
RewriteRule ^ public/holding.html [L]