Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
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.

How to add "delay" in redirect?

JoeBissJoeBiss Member
edited September 2016 in Help

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.

    Thanked by 3Nekki GCat Pwner
  • Put this in your htaccess with a condition:

    Header set Refresh "4;url=/somewhere/else"
  • joepie91joepie91 Member
    edited September 2016

    @classy said:
    Put this in your htaccess with a condition:

    Header set Refresh "4;url=/somewhere/else"

    That would be precisely the meta-tags-approach I was referring to (albeit as a header), and it's a really bad idea.

    Thanked by 2Nekki GCat
  • I'm intrigued. Why would you want to do this?

  • @classy said:
    Put this in your htaccess with a condition:

    Header set Refresh "4;url=/somewhere/else"

    Thank you. So I remove redirectMatch 301? or what exacrly?

    I do it like this?

    Header set Refresh "4;url=newwebsite.com"

    redirectMatch 301 ^/ http://newwebsite.com

    Thanks!

  • @JoeBiss you're completely ignoring @joepie91, listen to him

  • JoeBiss said: Thank you. So I remove redirectMatch 301? or what exacrly?

    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...

    Thanked by 5GCat classy Nekki tux Pwner
  • NekkiNekki Veteran
    edited September 2016

    @joepie91 said:
    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.

    Thanked by 2GCat Pwner
  • @Nekki said:

    @joepie91 said:
    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.

  • edited September 2016

    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.

  • head
    meta http-equiv="refresh" content="1;url=https://yourdomain.tld"
    /head
    

    ?

Sign In or Register to comment.