#1  
03-14-2011, 10:55 PM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,311
Thanked 374 Times in 341 Posts
Quick tip...

Code:
<?php
header('HTTP/1.1 301 Moved Permanently'); 
header('Location: http://www.somewhere.com/somepage.html');
?>
This is the full file -- no extra code (HTML, BODY, etc).

Save it as index.php if you're redirecting a folder or site.
Or some other PHP file that you're using as a redirect, i.e. theoldpage.php

Note: You don't have to redirect to a file -- it can be a folder or domain, too.
Examples:
Code:
header('Location: http://www.somewhere.com/');
header('Location: http://www.somewhere.com/folder/');
Trivia: You can also run HTML as PHP, to recycle an old HTML name and not rely on META redirects.
When the server is set to run HTML as PHP, simply save the code into a new HTML file -- i.e, index.html or index.htm

The better solution is to use .htaccess when available.

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
Reply




Thread Tools



 
All times are GMT -5. The time now is 06:03 AM