Posts Tagged ‘redirect’
If you want to redirect a page with PHP simple create a blank PHP file (example.php) and only include the following line:
<?php
header( ‘Location: http://www.example.com/new_page.html’ ) ;
?>
If you want to redirect an entire directory simply name this file index.php
NOTE: If you want a permanent redirect because you have moved your website and wish to keep your linkbacks from google and other search-engines and sites, follow the directions here.
I have just moved my blog to a new sub-domain but I did not want to loose my linkbacks. I had requested a redirect from my host, but did not know how long that would take. I discovered with Apache servers running on some kind of *nix server, given the right permissions, I could do this myself by editing the .htaccess file. The change was quite simple. I wanted to redirect http://fishbowl42.com/blog/ to http://oojah.fishbowl42.com/blog1.php/ I opened the .htaccess in my /blog directory and made the following alterations:
# BEGIN
redirect 301 /blog/ http://oojah.fishbowl42.com/blog1.php/
# END
Now I tested it out, by clicking on a linkback from www.tuxmachines.org and sure enough that link was directed to the corresponding URL on the new sub-domain.




