New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
How to add "delay" in redirect?
Hello!
I have a website which redirects to another website autmatically, but is there a way to add a "delay" let's say 4 seconds before it does this? currently I'm using .htaccess with this code. What can I do to make it delay and not go straighforward there?
I use this code because it basically redirects all the pages, the one indexed in Google as well (so not only one page).
Here's what I use.
redirectMatch 301 ^/ http://newwebsite.com
Thanks everyone.
Comments
You can't. The redirection is carried out by responding with a 301 status code instead of 200, and a browser will immediately follow that redirect.
The only way to do this is with meta tags or JS, and I don't recommend either - in fact, I don't recommend trying to implement a redirect delay at all. It's very confusing to end users, and search engines won't like you for it either.
Put this in your htaccess with a condition:
That would be precisely the meta-tags-approach I was referring to (albeit as a header), and it's a really bad idea.
I'm intrigued. Why would you want to do this?
Thank you. So I remove redirectMatch 301? or what exacrly?
I do it like this?
Thanks!
@JoeBiss you're completely ignoring @joepie91, listen to him
If you're redirecting ALL requests to a new site you should remove redirectMatch.
sighs
Enjoy your site getting delisted and your users hating it, I guess...
It's probably some traffic-related shite, don't give it a second thought.
Yeah, this is the real answer: have the server wait before responding. I'm not sure how easy it is to do with Apache directly or if a similar mod exists, but any scripting language could return a simple redirect after sleeping. This assumes it's no great burden for the server to be sitting on all the requests for 4 seconds.
?