简体   繁体   中英

Redirect Site Wide, Exclude Page

I need to redirect all pages on my website to another page:

harryfelton.host56.com -> harryfelton.host56.com/webisteDown.php

The thing is that either it doesnt redirect or it redirects the output page and causes a loop, I want to be able to put that in the .htaccess file and have any page on the website redirect to the websiteDown.php... Another problem I got was that there was no css styling on the page after redirect, Even though it is there if I go there myself, is is the extra '/' I think it is because if I add that it looses styles, But anyway, Anyone know how to do the redirecting?

Thanks in advance

You can use this rule in root .htaccess:

RewriteEngine On

RewriteRule !^(webisteDown\.php|.+?\.(?:jpe?g|gif|bmp|png|tiff|css|js))$ webisteDown.php [L,NC,R]

This rule redirects to /webisteDown.php if request is not for webisteDown.php OR any css, js, images files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM