Personal domain

Can I get my own web hostname?

Yes.

All CSE accounts get an automatic virtual hostname on our web servers: USERNAME.web.cse.unsw.edu.au.

For example, http://z1234567.web.cse.unsw.edu.au/ is equivalent to http://cgi.cse.unsw.edu.au/~z1234567/.

It runs on the CGI servers, so you can put PHP and other CGI Scripts there.

To be clear, this isn't a full virtualhost - you can't run an appserver this way, for instance - but it does give you prettier URLs for hosted content.

Redirecting web requests

If you want, you can automatically redirect visitors from www.cse.unsw.edu.au/~username/ to username.web.cse.unsw.edu.au/.

To do this, you need to create or edit your .htaccess file.

Because of the way these hostnames are implemented, you can't just use the Redirect directive to do this, or you'll get a redirection loop.

Instead, you'll need to use the Apache RewriteEngine.

Create or edit ~/public_html/.htaccess, which controls your top-level directory.

Add this to the top of the file, replacing <username> with your username:

RewriteEngine On RewriteCond %{HTTP_HOST} !^<username>.web.cse.unsw.edu.au [NC] RewriteRule (.*) http://<username>.web.cse.unsw.edu.au/$1 [R=301,L]

Important Notes

  • Forms - If you are using the POST method to submit to CGI Scripts, then you will need to make sure that the form uses the right domain name. If form data gets a Redirect, then the data is lost.
  • SSL access: If you are using Secure web pages, you may need to change the http to a https.

How does it work?

You can read up on using Apache's rewrite module here.

In essence, it says "if the hostname used to access the webpage is not USERNAME.web.cse.unsw.edu.au, then redirect (301 = temporary redirect) the browser to the other web page.

See Also

Last edited by Robert Doran 01/06/2018

Tags for this page:

domain, web, htaccess