Hi this could be a very stupid question, but I've gotta ask.
I'm re-coding a site so that instead of urls like
www.example.com/item.php?id=1
I can use
www.example.com/item/widget1
where in my db the record for widget1 has an id of 1
I'm Ok with the htaccess to rewrite the second url to required url
e.g. www.example.com/item/widget1 -> www.example.com/item.php?name=widget1
Now originally I was going to hardcode redirects of
www.example.com/item.php?id=1 ->
www.example.com/item.php?name=widget1
so that if there 20 items I'd have to have 20 redirects. But can I not do this in my php code using the header function?
I guess there are various overheads involved which I'm not aware of? Also I guess it would be better to keep all rewrites and redirects in the htaccess file for neatness.
What are the pros and cons of the two redirect methods - htaccess vs php code
Cheers
[Edited:Typo]