How do I redirect my site? non-www to www

A redirect is a simple way to automatically correct a users request to the correct page if you have moved the resource.

To make a redirect for a changed page, you need to add the following into a .htaccess file:

redirect <STATE> /old_page.name <FULLDOMAIN>/new_page.name

The <STATE> can be either

  • 301 - Moved Permanently - This and all future requests should be directed to the given URI
  • 307 - Temporary Redirect - In this case, the request should be repeated with another URI; however, future requests should still use the original URI.

So for example, if you wanted to permanently redirect www.example.com/smith.html to www.example.com/jones.html, you would put an .htaccess file in the web root folder of of your domain with the following:

redirect 301 /smith.html http://www.example.com/blog/jones.html

Use redirect to stop duplicate content on search engines

To prevent search engines being confused about your site, i.e. Is it http://yourdomain.com or http://www.your.domain.com, add the following to a .htaccess file

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

This will cause anyone who uses example.com to be automatically redirected to www.example.com

  • 0 gebruikers vonden dit artikel nuttig
Was dit antwoord nuttig?

Gerelateerde artikelen

Creating multiple FTP accounts

If you have multiple users connecting to FTP via a single FTP account at the same time then you...

How do I connect to FTP via CS5?

To connect to your website using Adobe Dreamweaver, try the following:1. Launch Dreamweaver 2....

How do I connect via FTP from Mac OS X?

The Finder in more recent versions of Mac OS X has built-in support for FTP. All you need to do...

How do I publish my site with Adobe GoLive?

When you're ready to publish your site, just connect to the FTP server by clicking the FTP Server...

How do I set permissions on files and scripts?

Doing a CHMOD (changing a file's permissions) is the setting of access privileges for a file....