I'm in the process of migrating my company's landing page from PHP to NextJS, and I'm trying to figure out the best approach for managing Google SEO indexing. Our existing URLs are structured as `domain.com/en/about.php` and `domain.com/fr/about.php`, while the new NextJS site will use routes like `domain.com/en/about` and `domain.com/fr/about`. This transition involves some changes, including dropping certain pages and copying over other content. What would be the best strategy for handling redirects to ensure SEO isn't negatively impacted? I'm considering adding redirect rules in the NextJS application, but I'm unsure if that's the best approach. Also, the current PHP site runs on Apache, but we plan to set up Nginx on the new server, likely using Google Cloud Run. Any advice would be appreciated!
3 Answers
Definitely focus on managing redirects at the reverse proxy level. Make sure you set a redirect rule that forwards traffic from the old `.php` URLs to the new, clean URLs. Mark the new URLs as canonical to help Google understand the changes. With Nginx on the new server, you should fine-tune those settings to maintain your SEO rankings while making this switch.
It’d be a good idea to handle the redirects at the Nginx level rather than within your NextJS app. That way, the server takes care of forwarding `.php` URLs to their new counterparts without needing the app to do the heavy lifting. Set up permanent redirects, update your sitemap with the new URLs, and ensure those new pages have the right canonical tags. This should help mitigate any SEO issues during the transition.
You can seamlessly redirect old URLs to the new ones when you move to NextJS. Setting it up at the server level should keep things tidy. Just remember to update your sitemap and submit it to Google once you’ve done the redirects!

Related Questions
What Is The Google Sandbox?
Customize Yoast Canonical URL Programmatically
Understanding Domain SEO Metrics
Google Search Console Beginners Guide
Dealing With A Pure Spam Penalty From Google
SEO Content Writer for Google Docs