Redirect using htaccess

Imagine this, you have a file http://www.domain.com/hosting.php and it is indexed by google. But one day you rename the file into http://www.domain.com/myhosting.php. This means that http://www.domain.com/hosting.php does not exist any more. You need to google and your website visitor to go to the new file. The smoothest way to redirect your visitors is to use an .htaccess file. The server checks first for an .htaccess file. So the old page nerver loads, and the visitors are sent directly to the new page.

The code is:

No related posts.

1 comment(s)

  • Sep 13, 2008 by htaccess redirect

    Don’t forget when fixing the homepage issue to redirect the non-www to the www, common SEO mistake.

    RewriteEngine On
    Options +FollowSymLinks
    RewriteCond %{HTTP_HOST} ^domain.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

  • Any feedback from you?

    This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage.

Jul 5, 2008 by

Want to set up your own web server at home? Read this guide

Super Green Hosting HostGator GreenGeeks WP Web Host green web hosting ad