professional-search-06-seophp-include-url-redirect.inc.php / php
<?php // load the URL factory library require_once 'url_factory.inc.php'; // redirect requests to index.php and index.html to the root function fix_index_url() { // if the request is for index.php we redirect to ./ if (preg_match('#(.*)index\.(html|php)_SERVER['REQUEST_URI'], // perform a 301 redirect to the new URL header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . captures[1]); } } // redirects to proper URL if not already there function fix_category_product_url() { // obtain the proper URL of the current category/product page // 301 redirect to the proper URL if necessary if (SITE_DOMAIN . _SERVER['REQUEST_URI'] != proper_url); exit(); } } // returns the proper keyword-rich URL function get_proper_category_product_url() { // retrieve product and category IDs from the query string _GET['product_id']; _GET['category_id']; // retrieve product and category names from fictional database GLOBALS['products'][category_name = category_id]; // create keyword-rich URL category_name, product_name, // redirect to keyword-rich URL if not already there return proper_url; } ?>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.