|
|
Changing your site's structure or domain name
As a website owner, you will sooner or later be in a situation where you need to change some of your website's directory structures, file names or even its domain name.
In this article, we look at how you can make major structural changes to your website or even its domain name while ensuring that the transition doesn't have a negative impact on visitors as well as minimising the risk of adversely affecting your all-important search engine rankings.
Why change your site's structure or domain?
There are many possible reasons why you might want or need to change your site's structure. Some of the more common reasons include:
- As your site grows and its content changes, you might need to re-organise its content into more appropriate directories.
- You switch to a content management system such as Acclaim CMS.
- Old parts of your site close, but you don't want to lose any existing visitors.
- You choose a new domain name that you prefer to use instead of your existing one.
Before we begin...
Further below, we'll provide you with a step-by-step guide for making major changes to your site. First, however, we'll begin with a brief introduction to two important things you'll need to know: the different types of redirections and an overview of .htaccess files.
The different types of redirections
Most Web servers let you set up redirections. Put simply, when a redirection is set up, visitors who access an old location of your website are automatically redirected to a new location you specify.
There are different types of redirections:
- Permanent redirections are what you will be using in most cases. They involve the server sending what's called a "301" code to the Web browser or search engine robot accessing the site. This code notifies the Web browser or search engine that the page has been replaced by one in a new location. Search engines should recognise that the redirect refers to the same resource, and as a result update their index appropriately with no adverse impact on your search engine rank. Even so, all search engines differ, and while some will recognise the change, others might not.
- Temporary redirections in comparison are useful when you are performing site upgrades and only want to temporarily send visitors to a new location while the changes take place. Temporary redirections involve the server sending a "302" code. Unlike permanent redirections, temporary redirections will not be the best option when you make permanent changes to your site.
So how do you set up redirections? The best option is to use .htaccess files because they offer maximum flexibility. .htaccess files will be explained in more detail below. Redirections can also be set up from some site admin logins. However, doing so has several disadvantages including:
- If you switch hosting providers you might need to manually set up the redirections again. In contrast, using .htaccess files makes it much easier since you can upload the same file to a new server if required in the future.
- The admin login won't necessarily give you control over whether the redirection is temporarily or permanent while .htaccess files do.
- You might need to set up many individual redirections in circumstances where .htaccess files could allow you to use what are called "RewriteRules" to automate much of the work.
Redirections can also be set up using other methods such as using PHP code if you have a PHP website or using a meta tag redirect on a HTML webpage. However, .htaccess files are the easiest to set up and will result in faster response times.
An introduction to .htaccess files
A .htaccess file is simply a plain text file that contains configuration instructions for the server. The file is uploaded to the directory where the instructions are to apply. In most cases, this will be the website's root directory (ie: the folder on the server where your site's home page is located).
To create a .htaccess file, simply use a text editor to create a plain text file and rename the file ".htaccess". (Tip: if you have trouble creating a file named ".htaccess" on your computer, you could temporarily name the file "htaccess.txt", and then rename it to ".htaccess" once it is uploaded to the Web).
We'll look at the content you'll need to add to your .htaccess file in the next section below.
Note that .htaccess files are supported by most servers and Web hosts (ie: those that use Apache Web servers), but not all. If your site is hosted with Multimedia Australia or our Hosting Reliance division, .htaccess files are supported on all Web hosting plans.
A step-by-step guide to changing your site's structure
The following step-by-step guide will outline the process of changing your site's structure:
- Backup your existing site and keep an archive so that you can easily go back if you make a mistake.
- Comprehensively plan the new structure. If you intend to perform a major restructure of your site, drawing the new file and directory structure on paper can be helpful. If you're not sure where to start, you could try grouping each webpage into categories, and perhaps using those category names as new directories for your site.
Go through each webpage on your site and move it to the new location you planned in Step 2. Next, for each page that you move, add a line similar to the following line to your .htaccess file (where /original.html is the original location of the webpage, and http://www.websitebytes.com/newlocation.html is the new location):
RedirectPermanent /original.html http://www.websitebytes.com/newlocation.html
Of course you'll need to specify the applicable domain name for your site.
It is a good idea to create a single test redirection to make sure your server is compatible before making changes to your entire site.
You can specify sub-directories as in the following example:
RedirectPermanent /subdirectory/original.html http://www.websitebytes.com/newsubdirectory/newlocation.html
- Upload your new site layout to the server once you have finished, together with the .htaccess file you created, then visit your site to ensure it displays correctly.
Changing your site's domain name
If you want to permanently change your domain name, two approaches are explained below. For each step, you'll need to first set up a new Web hosting account for the new domain name and upload your files. Next, do one of the following:
- Park your old domain name with your new Web hosting account (You can do this if you host your website with Multimedia Australia for example). Whenever someone accesses your site using its old domain name, they will then automatically be redirected to the same location on your new site.
Alternatively, you can add the following to a .htaccess file on your old website (replacing "http://www.websitebytes.com" with the domain name for your new site).
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.websitebytes.com/$1 [R=301,L]
As always, test your site immediately after you've uploaded the .htaccess file to ensure it is working correctly.
Other considerations
Some things to consider are:
- If using .htaccess files, they might already contain existing instructions, such as specifying error pages. If this is the case, the redirection instructions can be integrated into the existing .htaccess file.
- Whether you need to also redirect your email to accounts on your new domain name. If hosting your site with Multimedia Australia and you are parking your existing name. This can be done via your site's control panel.
View more articles...
|
|