homepage Welcome to WebmasterWorld Guest from 54.166.95.146
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
database change and unsure of best redirect route to take
redirecting pages from asp database to new php pages
juliat72




msg:4643913
 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)?

 

g1smd




msg:4644027
 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved