Msg#: 4643911 posted 3:39 pm on Feb 10, 2014 (gmt 0)
I have a new client who has a current website (store) that pulls from a database with very long winded query string URLs - they are getting the database redone along with a new CMS in php which will produce static pages with more friendly/relevant page names
Now my issue is that some important URLs are already indexed and show in the results with Google so we need to tell them and others that the page has moved
What's the best way to do this (there are approx 100 category & sub-category pages and hundreds more product pages)?
Msg#: 4643911 posted 11:39 pm on Feb 10, 2014 (gmt 0)
Internally rewrite requests for the old format URLs to a PHP script.
In this PHP script look up the new URL and use the PHP HEADER directive to send a 301 redirect to the correct URL.
Exactly how you look up the new URL is up to you. They could be entries in a PHP array or in a database table.
One other thing to add is where a request resolves to the fix up script, but there is no matching new URL to redirect to, instead return a 404 HEADER and INCLUDE the 404 page.
Bonus functionality: have this PHP script write a log file of requests served, updating to a new filename on a, say, weekly basis. Use it to monitor accesses by search engine bots and to see the fall of in (real) visitor numbers.