Welcome to WebmasterWorld Guest from 54.242.63.214

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

database change and unsure of best redirect route to take

redirecting pages from asp database to new php pages

     

juliat72

3:39 pm on Feb 10, 2014 (gmt 0)

5+ Year Member



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)?

g1smd

11:39 pm on Feb 10, 2014 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month