How would I re-direct a old .html page to my new kirby equivalent. Such as https://mysite.com/page.html to https://mysite.com/page (not necessarily the same name).
I have about 10-15 .html pages to re-direct to their new page. The names may change.
I figured I could just add them manually to my .htaccess until google picks up the new ones and then I can remove it.
What would be the cod I need to insert in my .htaccess to acomplish this?
You can accomplish this by means of the
RewriteRule "^/page\.html$" "page" [R]
[R] indicates an external redirection with HTTP status code 302 which means “temporary”. Clients will try to reach out to the old URL next time. Once you are sure with your redirects, you can use
RewriteRule "^/page\.html$" "page" [R=301]
to make them “permanent”.
I wouldn’t remove them later on because you will never know when the last client (with Google being just among one of them) has got the info and update its cache accordingly.
If your naming convention is always
OLDNAME, then you could use
RewriteRule "^/(.+)\.html$" "$1"
OLDNAME is a valid Kirby resource, Kirby’s frontend controller already handles this for you.
Thank you very much for this detailed explanation.
Also, you never know whether other sites have links to these old URLs that they never update. So, it’s better to keep the redirects.