Add .htaccess specifying redirects for converting an old site

One important thing for SEO when migrating a site is maintaining continuity between old links and new locations of content. I’ve made the mistake in the past of not redirecting old links to new content locations and my client’s SEO dropped significantly, taking a year to return to previous levels.

I have a Frontity project that is also a migration. How would one upload an .htaccess specifying redirects for old content locations? Do I just add it in the root directory (like I did the robots.txt file)? Do I not use an .htaccess and instead use the frontity-tiny-router? Any help would be much appreciated!

Does frontity-tiny-router have a <Redirect> component that would work better?

Hi @david1

The “router” packages (tiny-router is one implementation but there could be more) are not managing any route redirections for now

If you think they should you could add a “Feature Discussion” proposal here

So, the solution of redirecting URL’s in your project depends on the server you’ll be using to serve your Frontity project

For example, if you decide to deploy your site to Vercel you could define your redirections from a configuration file

Hope this helps

Hey @juanma, thanks a lot for the response. It looks like the configuration file in Vercel would do the trick. However, following the deployment instructions, it instructs using a now.json, which contains nearly identical information to the vercel.json in the other link you sent. Are they one and the same? Does the name change have only to do with the rebranding of Vercel? I would recommend updating the documentation to be more up-to-date and use Vercel terminology (not sure if you would be the person to mention about that)…

Hi @david1,

I think you’re right .
I have created an issue in the docs to check this ASAP and update the docs accordingly.

Have you tried to deploy using just the vercel.json with the content of now.json? Did it work for you?

Thanks for the info :+1:

Hey @juanma,

Editing my now.json worked for me, thanks for pointing me in the direction of the Vercel documentation for specifying redirects, it worked like a charm!

2 Likes

Hi @david1,

Glad to hear that!

I updated the docs to reflect the latest changes from vercel including the use of a vercel.json rahter than the former now.json

https://docs.frontity.org/deployment/deploy-using-vercel

1 Like