在堆棧溢出中有大量的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