Thursday, June 08, 2006

Using Redirects to Change File Names

The following is a simple way to redirect a page A to a page B with a few lines.

In .htaccess using mod_rewrite:
RewriteEngine on
RewriteRule ^foo\.php$ bar.php [R=301,L]

In PHP (place in foo.php):
$base_url = 'http://www.foo.com';
header('Location: ' . $base_url . 'bar.php';

Hope this helps!

0 Comments:

Post a Comment

<< Home