301 vs 302 redirect: which one to use, and the mistakes that stick
Why browsers remember a 301, redirect chains, and how to audit them with curl.
Read the guideCDN.com.tr Help
Send requests for a domain to another domain with a permanent (301) redirect from the Redirects tab of Delivery Rules. The path and query string are kept, and Auto SSL certificate checks under /.well-known keep working.
Cache, security, WAF, and purge
Send requests for a domain to another domain with a permanent (301) redirect from the Redirects tab of Delivery Rules. The path and query string are kept, and Auto SSL certificate checks under /.well-known keep working.
For requests over decides which requests are redirected. A new redirect starts with both ticked.
https:// and the same domain under To: send HTTP visitors to HTTPS.The choice under To.
http:// on the target, an HTTPS request to https://.https://: every redirected request goes to HTTPS on the target.http://: every redirected request goes to HTTP on the target.Both are on the Redirects tab.
One redirect can cover several domains of the account.
Expected result: The redirect appears in the Domain redirects table with its From, Protocols and To, and the page shows Live once the edge serves it.
Request an old URL with a path and a query string over each redirected protocol and, on a domain with Auto SSL, one path under /.well-known/ over HTTP.
/.well-known/ on the redirected domain over HTTP (on a domain with Auto SSL).Expected result: A 301 whose location is the target with the same path and query string; the /.well-known/ request (on a domain with Auto SSL) is answered without a redirect to the target.
curl -s -o /dev/null -D - 'http://old.example.com/blog/post?id=7' | grep -iE '^(HTTP|location)'
curl -s -o /dev/null -D - 'https://old.example.com/blog/post?id=7' | grep -iE '^(HTTP|location)'
curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' http://old.example.com/.well-known/acme-challenge/test
A redirect stays until you delete it.
Expected result: After a delete, the domains are served by their rules again, and the page shows Live once the edge serves the change.
https:// under To)A brand moves from old.example.com to new.example.com, or a site settles on one address (www.example.com rather than example.com, HTTPS rather than HTTP), and every old link should land on the same page at the new address.
https:// or http://, and enter the target domain without a path, such as new.example.com. The Example line shows where /blog/post?id=7 goes.Location keeps the path and query string: /blog/post?id=7 on the old domain goes to /blog/post?id=7 on the target./.well-known/ keep working: over HTTP, those requests are answered by the domain's certificate-check rule, not by the redirect..jpg, .jpeg and .png requests to a redirected domain are optimized and served instead of redirected; the redirect's row in the Domain redirects table and the editor say so for each domain.http://www.example.com to https://www.example.com is not a loop, and the editor accepts it.Add a redirect for that domain, tick only HTTP under For requests over, choose https:// under To and enter the same domain. HTTP requests then get a 301 to the HTTPS address with the same path and query string, and HTTPS requests are served by the domain's rules as before. Make sure the domain already works over HTTPS with a certificate.
Domains are matched as they are written, so tick every form you serve that should go to the target: when both example.com and www.example.com move to new.example.com, tick both. To settle on www.example.com, tick only example.com.
The edge redirects a domain only where it serves it. Over HTTP, a delivery rule must list the domain; over HTTPS, an HTTPS rule must list it and the domain needs a certificate. Add the domain to a rule first, or finish its certificate.
Each note says where the redirect does not work as written. Not used: an older redirect already covers that domain over that protocol; change or delete one of the two. A target with no protocol keeps browsers on the same domain: press Edit, check the protocol under To and press Save redirect. A domain with no rule, or no certificate, for a protocol is not redirected over it; add the domain to a rule or finish its certificate. While account-wide image optimization is on, .jpg, .jpeg and .png requests are optimized instead of redirected.
Browsers remember permanent (301) redirects. Check with curl or a private window: after the delete, the domain is served by its rules again.
The Mobile redirect card on the same tab sends visitors on mobile browsers to another domain with a temporary (302) redirect, on every domain of this account, and keeps the path and query string. While it is on, mobile browsers get that 302 first. The mobile site domain must be one this account does not serve.