I recently rebuilt my website, and then realized that a lot of the old URLs to my domain end in .php and I need to redirect them to the new site.
I am currently managing my DNS records through CF, and have changed to thier nameservers. A, AAAA and CNAME are proxied. I built the site using Hostinger, but they offer no 301 redirect options or custom error page options.
I tried using a bulk redirect and that did nothing.
I tried using a URI redirection rule and it almost worked. I set it to send all URIs ending in .php to a new page that I created. If you enter a URL to my domain that ends in .php directly into the browser’s url bar, it DOES redirect as it should. But if you click a link on a website or search engine that leads to a .php URL, you just get a blank 400 error page.
Does anyone know why it is only half working?
I have also heard that you can use a CF worker to intercept errors and redirect them, but I have tried it and it didn’t work. It might be my fault though, I don’t know much about code, but I would like to learn!
Sure. fdofmary.org is my domain. For instance, fdofmary.org.vocations is a new URL, where fdofmary.org/vocations.php is the old one that I would like to redirect to the new one. If you type the old one into your browser URL bar at the top, it will redirect you to an error page that I made and set it to redirect to. If you click it as a link, you get a blank 400 error page.
I would like it to redirect to the page that replaces it, About the Rose Garden Mission | The Franciscan Daughters of Mary, and I tried doing that in a bulk redirect but with no success. I figured is I could at least send all .php URLs to an error page, users would at least know why they ended up on the wrong page and would hopefully continue on to the page they were looking for.
I have 14 URLs in a bulk redirect that should be pointing to the URLs that replaced them. List is active and rule is enabled. Still not working
Update: I just realized that the links that are not redirecting are links that begin with https://www. So, I set up a rule that would send all www. requests to root, and then the .php redirect (above) would deploy and send it to my error page, but it does not appear to be working for the links that begin with www. and end with .php
I’m sorry for my lengthy replies, I am getting a little frustrated I guess… Been working on this kink for over week now.
Ok, I figured it out! I had forgotten to re-proxy CNAME
Just in case anyone else encounters a redirect rule that is not working:
Redirect rule to send the www. requests to root (make sure it is first in order)
Redirect rule to send faulty URIs to error page (as in screen shot)
Ensure that A, AAAA and CNAME are proxied
YAY!
I still don’t know why my bulk redirect is not working to send the faulty pages to their replacement page, but I am satisfied that users will at least make it to my site and can continue on to whatever page they were looking for in the first place.
Can you post your bulk redirect list and the rule to double check? Keep in mind that Bulk Redirects are executed after Single Redirects, so if you have a single redirect rule then it would take precedence over the bulk redirect list item.
Here are screen shots of the bulk redirect rule. It is active and applied.
Will the URI redirection rule override the bulk redirect rule? I had tried applying this bulk redirect before I had the URI redirect set up, and it didn’t work then either…