Webhosting Redirecting: Difference between revisions

From AAISP Support Site
No edit summary
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[File:Couk.png|link=:Category:Webhosting]]


=Redirecting non-www. Requests=
=Redirecting non-www. Requests=


If you would like your web site visitors to view your website without the 'www' part, then this is how to do it:
If you would like your web site visitors to view your website without the 'www' part, then this is how to do it. You can also use this to redirect a page to another domain etc.


==Overview==
==Overview==
#Create a DNS 'A' Record
#Create a DNS 'A' Record
#Create an index.http file to redirect visitors to your main page.
#Create an index.http file to redirect visitors to your main page.
#FTP the index.http file to your webspace


==Explanation==
==Explanation==
Lets assume that your domain is ''testing.me.uk''.
Lets assume that your domain is ''testing.me.uk''.


You will already have a CNAME DNS entry for 'www.testing.me.uk' set to 'www-server.co.uk'. However, by default we do not create a record for just 'testing.me.uk' so one will need to be created. This needs to be an 'A Record' and needs to point the the IP of our webserver.
You will already have a CNAME DNS entry for 'www.testing.me.uk' set to 'www-server.co.uk'. However, by default we do not create a record for just 'testing.me.uk' so one will need to be created. This needs to be an 'A Record' and needs to point the IP of our webserver.


We then need to tell the webserver to redirect visitors over to your website with the 'www', hence the redirect file.
We then need to tell the webserver to redirect visitors over to your website with the 'www', hence the redirect file.


=Setting up the Redirect=
=Setting up the Redirect=


==Creating the DNS Entry:==
==Creating the DNS Entry==
The DNS entry will need to be an 'A Record', set to 81.187.30.81, ie:
The DNS entry will need to be an 'A Record', set to 81.187.30.81, i.e.:


[[File:Webhosting-dns.png]]
[[File:Webhosting-dns.png]]
Line 30: Line 28:


HTTP/1.0 301 Page moved
HTTP/1.0 301 Page moved
Location: http://www.testing.me.uk/
Location: https://www.testing.me.uk/
Content-Length: 0
Content-Length: 0
With a blank line at the end (the blank line is important).
'''With a blank line at the end (the blank line is important).'''


You can download this example here: [[File:index.http.zip]] (Don't forget to unzip and edit the file)
You can download this example here: [[File:index.http.zip]] (Don't forget to unzip and edit the file)


FTP to your web site, using the username of testing.me.uk (ie, without the www). There should be no files there, as your main website will be held under the 'www' directory which you'll see.
FTP to your web site, using the username of testing.me.uk (i.e., without the www). There should be no files there, as your main website will be held under the 'www' directory which you'll see.


Upload the index.http file, and then go to your web address without the www, and you should get redirected.
Upload the index.http file, and then go to your web address without the www, and you should get redirected.


Here we are using FileZilla to FTP the index.http file, we log in to the webspace using the username testing.me.uk (i.e. no www. prefix), and we simply upload the single index.http file. Our main website can be found in the www directory that you'll see.
Do contact support if you need help, as they can do this for you.

Here we are using FileZilla to FTP the index.http file:


[[File:Webhosting-ftp-indexhttp.png]]
[[File:Webhosting-ftp-indexhttp.png]]


Do contact support if you need help, as they can do this for you.


=Redirecting to another website=
==Other Webhosting pages:==
The above explains how to redirect yourdomain.com to www.yourdomain.com, bit if you want to redirect yourdomain.com and www.yourdomain.com to a completely different website or page, then you can do a similar thing to the above.
<ncl style=bullet maxdepth=5 headings=bullet headstart=2 showcats=1 showarts=1>Category:Webhosting</ncl>
# Create your index.http file as above, but change the 'Location' the the web site or web page that you want to redirect to

# Upload the index.http to your website
[[File:aa-button.png|link=http://aa.net.uk/domains-webspace.html|Webhosting Service page on our main website]]
## when you FTP you want to add the file to the 'root' as well as the 'www' folder - this will then make sure that the redirect will be used whether you go to your domain with or without the www prefix.
## The easiest way to do this is to FTP using the username www.yourdomain and then repeat the upload with the username without the www. prefix




[[Category:Webhosting]]
[[Category:Webhosting|Redirecting]]
[[Category:Domains]]

Latest revision as of 12:40, 17 July 2023

Redirecting non-www. Requests

If you would like your web site visitors to view your website without the 'www' part, then this is how to do it. You can also use this to redirect a page to another domain etc.

Overview

  1. Create a DNS 'A' Record
  2. Create an index.http file to redirect visitors to your main page.
  3. FTP the index.http file to your webspace

Explanation

Lets assume that your domain is testing.me.uk.

You will already have a CNAME DNS entry for 'www.testing.me.uk' set to 'www-server.co.uk'. However, by default we do not create a record for just 'testing.me.uk' so one will need to be created. This needs to be an 'A Record' and needs to point the IP of our webserver.

We then need to tell the webserver to redirect visitors over to your website with the 'www', hence the redirect file.

Setting up the Redirect

Creating the DNS Entry

The DNS entry will need to be an 'A Record', set to 81.187.30.81, i.e.:

Webhosting-dns.png

This can be done on the Control Pages.

Creating and Uploading the index.http file

An index.http file is a special file that our webserver will interpret specially. The file should be like this:

HTTP/1.0 301 Page moved 
Location: https://www.testing.me.uk/ 
Content-Length: 0
 

With a blank line at the end (the blank line is important).

You can download this example here: File:Index.http.zip (Don't forget to unzip and edit the file)

FTP to your web site, using the username of testing.me.uk (i.e., without the www). There should be no files there, as your main website will be held under the 'www' directory which you'll see.

Upload the index.http file, and then go to your web address without the www, and you should get redirected.

Here we are using FileZilla to FTP the index.http file, we log in to the webspace using the username testing.me.uk (i.e. no www. prefix), and we simply upload the single index.http file. Our main website can be found in the www directory that you'll see.

Webhosting-ftp-indexhttp.png

Do contact support if you need help, as they can do this for you.

Redirecting to another website

The above explains how to redirect yourdomain.com to www.yourdomain.com, bit if you want to redirect yourdomain.com and www.yourdomain.com to a completely different website or page, then you can do a similar thing to the above.

  1. Create your index.http file as above, but change the 'Location' the the web site or web page that you want to redirect to
  2. Upload the index.http to your website
    1. when you FTP you want to add the file to the 'root' as well as the 'www' folder - this will then make sure that the redirect will be used whether you go to your domain with or without the www prefix.
    2. The easiest way to do this is to FTP using the username www.yourdomain and then repeat the upload with the username without the www. prefix