Skip to content

Personal CS Webpages


The ODU CS Department provides faculty and students the ability to host web pages from their CS Unix Account.

Accessing Your Web Directory

Your home directory, which contains ~/secure_html, can be accessed on our Linux Servers. This ~/secure_html directory is the root for your personal webpage.

Critical: File & Directory Permissions

For your webpage to be properly accessible to the webserver, the ~/secure_html directory and all its contents must have specific Linux permissions:

  • Directories: Must have other read and execute permissions (e.g., chmod o+rx directory_name). This typically means permissions like 755 or rwxr-xr-x.
  • Files: Must have other read permissions (e.g., chmod o+r file_name). This typically means permissions like 644 or rw-r--r--.
  • Executable Files (e.g., PHP scripts): If a file is intended to be executed by the webserver (like a PHP script), it must also have other execute permission (e.g., chmod o+rx script.php). This typically means permissions like 755 or rwxr-xr-x for scripts.

How It Works

Webpage Hosting Details

User websites are hosted at https://www.cs.odu.edu/~<username>/, where <username> is your CS Unix username. The document root (the main folder for your website files) for this URL is located at /home/<username>/secure_html/ on the CS Unix servers.

Example:

File Path on Server Corresponding Web URL
/home/<username>/secure_html/index.html https://www.cs.odu.edu/~<username>/index.html
/home/<username>/secure_html/images/pic.jpg https://www.cs.odu.edu/~<username>/images/pic.jpg

Each user gets a unique webserver configuration that is automatically created. Content will not be served until files are placed in ~/secure_html/ with the correct permissions.


Common Questions

How do I redirect my CS webpage (or a part of it) to an external site?

Problem: Some users would like https://www.cs.odu.edu/~<username>/ (or a subdirectory) to automatically redirect visitors to an external webpage.

Solution: 1. Create a file named .htaccess in the directory within ~/secure_html/ that you want to redirect. * For redirecting the entire ~<username>/ site, create ~/secure_html/.htaccess. * For redirecting ~<username>/project/, create ~/secure_html/project/.htaccess. 2. Ensure the .htaccess file has read permissions for the webserver (e.g., chmod 644 .htaccess). Some configurations might require execute, but start with read. 3. Add the following content to the .htaccess file, replacing http://www.newdomain.com/ with your desired destination URL:

```apache
Redirect 301 / http://www.newdomain.com/
```
If you are placing the `.htaccess` file in a subdirectory (e.g. `~/secure_html/project/.htaccess`) and want to redirect just that path, you might specify the path relative to that directory:
```apache
Redirect 301 /project/oldpage.html http://www.newdomain.com/newpage
```
Or, more commonly for redirecting the entire subdirectory:
```apache
Redirect 301 / http://www.newdomain.com/path_for_this_project/
```
*(The `/` after `301` refers to the root of the directory where the `.htaccess` file is located.)*

Redirecting ~/secure_html/ to Google

To redirect https://www.cs.odu.edu/~<username>/ to https://www.google.com/, create ~/secure_html/.htaccess with the following content:

Redirect 301 / https://www.google.com/

Why do I get a 403 Forbidden error when accessing a directory, even if permissions seem correct?

Problem: Navigating to https://www.cs.odu.edu/~<username>/some_directory/ results in a 403 Forbidden error, even though all folders and files within that directory have the correct permissions. The server isn't showing a list of files.

Solution: This usually happens because directory indexing is turned off by default for security reasons. You have two main solutions:

  1. Create an Index File (Recommended): Create a file named index.html (or index.php, etc., depending on what the server is configured to look for as a default page) inside the ~/secure_html/some_directory/ directory. This file will be displayed automatically when someone visits that directory's URL.

  2. Enable Directory Indexing (Use with Caution): If you explicitly want the webserver to display a list of files in that directory when no index file is present, you can enable indexing for that specific directory. Create or edit the .htaccess file within ~/secure_html/some_directory/ and add the following line:

    Options +Indexes
    
    Ensure this .htaccess file also has the correct read permissions for the webserver.

    Security Note on Options +Indexes

    Enabling directory indexing can expose all filenames within that directory. Only use this if you are sure you want all contents to be listable. It's generally better practice to use an index.html file.