Personal domain

Can I get my own domain name?

Yes! All CSE accounts get an automatic domain name at USERNAME.web.cse.unsw.edu.au. If your username is jsmith123, you can browse to http://jsmith123.web.cse.unsw.edu.au/. This URL is equivalent to http://cgi.cse.unsw.edu.au/~jsmith123/. It runs on the CGI servers, so you can put PHP and other CGI Scripts there.

Forcing redirects

Usually, people visit your page via a URL like http://www.cse.unsw.edu.au/~username/. If you want everyone to be automatically redirected to your special web.cse domain, you need to use a .htaccess file. Because of the way the web domains are implemented, you can't just say " Redirect /~username/ http://username.web.cse.unsw.edu.au/ " - this will give you a Redirect loop (error "URL Redirection limit exceeded"). A more specific approach is required. Edit ~/public_html/.htaccess. This file controls your top-level directory. Add this to the top, 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 essense, 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 25/11/2011

Tags for this page:

domain, web, htaccess