C
C#5d ago
navin007

✅ status code 200 (from disk cache) instead of 301

Recently I had mad a IIS rule to 301 redirect a particular url to another page. For the first time if I hit the url it's status code is 301(permanent) and the redirection is happening. But if I hit the url again it's returning 200 status code for the document but the redirection is happening. I want the status code as 301 even if I hit it multiple times in the same browser. But also I need this fix to happen for the particular url and doesn't affect other urls of the site
5 Replies
Sehra
Sehra5d ago
the browser will cache a 301, you sure that part is hitting the server?
Pobiega
Pobiega5d ago
301 is permanent - the browser caches this very strongly and will just follow the redirect without hitting the server. This by design and follows the http standard. if you want to hit the server each time, you need 302 or 307
navin007
navin007OP3d ago
This is a business requirement to record the count of landing page so I need it to be 301 so that in Google analytics it will track the new url
Pobiega
Pobiega3d ago
Business requirements can't change the fundamental laws of nature, or the way browsers implement the HTTP protocol 301s are permanent
navin007
navin007OP3d ago
I need it to be permanent. Is there a way to set response head cache control to no cache no store for those particular url pattern

Did you find this page helpful?