在堆栈溢出中有大量的HTACCESS维护模式重定向,但我还没有找到一个适用于我的结构的维护模式。HTACCESS维护模式重写
我想将www.example.com重定向到www.example.com/sub/maintenancemode.html。不过,我仍然想访问subdomain.example.com。子域名将被用于开发和分期的目的等
在堆栈溢出中有大量的HTACCESS维护模式重定向,但我还没有找到一个适用于我的结构的维护模式。HTACCESS维护模式重写
我想将www.example.com重定向到www.example.com/sub/maintenancemode.html。不过,我仍然想访问subdomain.example.com。子域名将被用于开发和分期的目的等
这里是你的.htaccess
文件:
RewriteEngine On
RewriteBase/
RewriteCond %{HTTP_HOST} !^subdomain\.example\.com$
RewriteRule ^.* /sub/maintenancemode.html?
感谢您的回复。结束使用下面的代码。 :) – Richy
然后你可以标记我的回复或你的回答关闭这个线程。 [接受答案如何工作?](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) –
最终在年底使用这种
RewriteEngine On
RewriteBase/
RewriteRule ^(dev|staging)($|/) - [L]
RewriteCond %{REQUEST_URI} !/maintenance/coming-soon.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /maintenance/coming-soon.html [R=302,L]
您还需要以某种方式阻止'subdomain' ,否则可能会被索引。你可以使用相同的代码,只需要阻止每个人的所有内容,除了少数几个IP? – MrWhite