I'm looking to put in a 301 redirect to an application for specific values of a query string parameter.
For Example:
http://www.example.com/page?id=1
→ redirect to a new pagehttp://www.example.com/page?id=2
→ render normal responseHow do browsers cache the redirect?
Specifically, after visiting the first URL, will some browsers start performing a 301 redirect for the id=2
, or are redirects based on the full URL?
In the absense of cache control directives that specify otherwise, a 301 redirect defaults to being cached without any expiry date. That is, it will remain cached for as long as the browser's cache can accommodate it.
Google Chrome will cache your 301 redirects. To get around this, and to keep the tabs open, you'll just need to clear your browser cache.
The HyperText Transfer Protocol (HTTP) 301 Moved Permanently redirect status response code indicates that the requested resource has been definitively moved to the URL given by the Location headers. A browser redirects to the new URL and search engines update their links to the resource.
Browser will definitely cache the 301 redirect because it's a permanent redirect. Basically you're telling the browser never to look at the original URL and to automatically go to the second URL. Same thing happens for any search engines. If you ever plan to use that original URL again, make sure you use a temporary redirect.
Specifically, after visiting the first URL, will some browsers start performing a 301 redirect for the id=2, or are redirects based on the full URL?
No, the browser should see each URI in it's entirety, so page?id=1
is a different URL than Page1?Id=2
and the 301 redirect would only apply to the first url.
Keep in mind that the browser is doing the redirect and implementing its own rules based on its interpretation of the HTTP spec. If there are any bugs in the browser you could get unpredictable results, but the short answer is that they're different requests to different urls and each get their own HTTP status code therefore they can be treated as separate pages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With