Check if Your 301 Redirect is Working Using cURL


Did you just change domain names and redirect your old domain name to your new domain, but when you try in your browser it’s not reflecting this change?

It could be caching, but rather than waste time clearing cache or opening an incognito window, just use cURL.

Using this cURL command will show you the location of the redirect:

$ curl -I

Should return something that looks like this:

HTTP/2 301 
server: nginx
date: Wed, 10 Nov 2021 16:06:01 GMT
content-type: text/html; charset=utf-8
vary: Cookie
x-ac: 2.sea _bur 
strict-transport-security: max-age=15552000; includeSubDomains; preload

You’ll notice it’s working since you’ll see the 301 redirect on the first time and the location: of your new domain.

If you’re not seeing the location, make sure you add your https:// if you have SSL forced on your domain.

Leave a Reply

Your email address will not be published. Required fields are marked *