0

I have an old website written in PHP in which all of the pages are served as parameters, in the format:

https://www.mywebsite.com/index.php?action=view_page&course=main&type=sausages

I'm trying to make better descriptive, SEO-friendly URLs, and I've been doing it in .htaccess ReWrite on a page-by-page basis using the following rules:

ReWriteRule ^main-course-sausages index.php?action=view_page&course=main&type=sausages [NC,L]

This works great in that if a user enters the new URL, they see the content from the old URL. I put the new short URLs in the sitemap and Google has indexed them.

I've also added canonical links to each webpage so that they point to the SEO-friendly URL and Google has picked up on them.

What I want to do is set up a redirect so that if a user enters the old URL, they get redirected to the new URL. I want this to show in their address bar. Another reason I want to do this is to ensure that the link juice from the old URLs and pass it to the new ones - some search engines don't seem to pick up on canonical links and treat them as duplicates.

There are only about 50 webpages on the site and I don't mind setting up each page manually rather than using one single complicated redirect rule.

I'm conscious of accidentally causing a redirect loop in the .htaccess file.

This is my first StackOverflow question after using the site for many years, so thank you in advance and apologies if the question seems noobish.

1

0