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 = '';
header('Location: ' . $base_url . 'bar.php';

Hope this helps!


Post a Comment

<< Home