Multiple Page Redirect Help - htaccess/codeigniter

Soldato
Joined
8 Oct 2005
Posts
4,185
Location
Midlands, UK
I have the following situation on a new site I'm about to release and would appreciate your opinion.

The old site has hundreds of articles in the following format:

www.site.co.uk/article-details.php?id=[NUMBER]

I've imported all of these articles, using the same IDs in a new Codeigniter based CMS. The new content now has the folloowing URL structure: site.co.uk/articles/[ARTICLE-SLUG].

So www.site.co.uk/article-details.php?id=123 would need to go to www.site.co.uk/articles/the-slug-from-my-database.

To do this, I've added the following rule in my htaccess file:

Code:
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$ RewriteRule ^article-details\.php$ http://www.site.co.uk.co.uk/articles/redirect/%1? [R=302,L]
As I need to first lookup the slug, I have redirected the request to my

artivcles controller and the redirect method - this simply looks up the article slug from the ID, sets a 301 header and redirects to the new URL.

Now this all works, but behind the scenes I'm not sure if I have an issue or not. The initial request for www.site.co.uk/article-details.php?id=123 would return a 302 going to www.site.co.uk/articles/redirect/123 and then a 301 from the controller. So essentially, I've set a 302 header before the 301 redirect.

Can anyone see this as being an issue, as it would be nice to maintain any link authority via a 301.

Cheers
 
Back
Top Bottom