Fundamentally, a website is nothing more than a collection of HTML files. Those HTML files can then pull in links to other HTML files, images, videos, style sheets, and other files to be downloaded.
Note that using a UNIX/Linux system to work with your website is highly recommended, especially when editing .htaccess
or script files.
To get started, you'll need to connect to your web site storage space.
All of our UNIX/Linux machines have the web space mapped to the /web
directory.
Windows users can access the space \\tools.ecn.purdue.edu\web
.
User sites will be in the users
folder.
Other sites will be in either the entities
or groups
folder, depending on how the site was set up.
Once you've found the appropriate folder, create a plain text file (with Notepad, vim, emacs, etc.) called index.html
or index.php
with some text in it like:
<h1>Simple Website!</h1>Congratulations, you have a simple website!
There are 2 ways to set up page wrappers, or adding content to the top & bottom of every page on your site, depending on how you've created your site. For static HTML, use the perl script. For PHP sites, use the PHP method.
For either method, you'll need to create a folder called private
under the main website folder and put files called top.inc
& bottom.inc
in that folder.
Put the HTML content you want at the top of your pages in top.inc
, and the content you want at the bottom in bottom.inc
.
You will also need to create a .htaccess
file to alter the Apache Web Server configuration of your page.
This will only apply to files saved with a .whtml or .wshtml extension.
Put this in the .htaccess
file:
AddHandler add-wrap .whtml .wshtml AddType text/x-server-wrapped-html .whtml AddType text/x-server-wrapped-parsed-html .wshtml Action add-wrap /private/wrapwhtml.pl DirectoryIndex index.wshtml index.whtml index.html index.php SetEnv HTTP_WrapTop /private/top.inc SetEnv HTTP_WrapBottom /private/bottom.inc
And put this in a file called wrapwhtml.pl
in that private
folder:
AddHandler add-wrap .whtml .wshtml AddType text/x-server-wrapped-html .whtml AddType text/x-server-wrapped-parsed-html .wshtml Action add-wrap //wrapwhtml.pl DirectoryIndex index.wshtml index.whtml index.html index.php index.php3 SetEnv HTTP_WrapTop / /top.inc SetEnv HTTP_WrapBottom / /bottom.inc
This will only apply to files saved with a .php extension. You will also need to substitute in the full path to your web directory.
Put this in the .htaccess
file:
php_value auto_prepend_file "/web/XXX/YYY/private/head.inc" php_value auto_append_file "/web/XXX/YYY/private/foot.inc"
The Apache hosting service currently supports PHP & CGI scripting.
Any file with a .php
extension will be processed by PHP.
To use CGI scripts, add the following to your .htaccess
file:
Options +ExecCGI AddType application/x-httpd-cgi .cgiThat will allow any file with a
.cgi
extension to run.
You can add other extensions by duplicating the last line & replacing .cgi
with the extension of your choice.
You can write your CGI scripts in bash, perl, python, ruby, or a multitude of other common languages.
Also make sure your scripts are marked as executable, or they won't run.
We support 2 methods of authenticating users: Purdue's I2A2 career account authentication, or Apache Basic HTTP authentication.
Both of these methods are enabled by adding to your .htaccess
file.
To require any valid Purdue login, add this to the .htaccess
:
require any-user
To require a specific Purdue login, add this to the .htaccess
:
require i2a2-user thomps78 loganm blackm
For HTTP Basic Authentication, add this to the .htaccess
:
AuthBasicProvider file AuthUserFile /web/XXX/YYY/htpassword AuthName "Basic Authentication Protected Site" AuthType Basic require user generic someone someoneelse
The Basic Authentication method requires a password file. To create one using the htpasswd command with a new user:
htpasswd -cs /webpath/private/.passwdfile user1You will be prompted to enter a new password for
user1
. If you check the .passwdfile
file, you will see all users created and their hashed/encrypted passwords.-c
flag is to create a new password file and the -s
flag is to use SHA encryption for passwords.
Use the man htpasswd
command to learn more about the usage and flags of htpasswd
.
To update an existing user's password or create a new user:
htpasswd -s /webpath/private/.passwdfile user2You will be prompted to enter a new password for
user2
.
See the Apache documentation for basic authentication for instructions on setting up your user(s).
chmod
command.
To be web accessible, a file must either be world-readable & executable or be set to the UNIX www group & group-readable & executable.
Typically, you'll want your permissions set to 755 (you can read, write, and execute, everyone else can read and execute).
index.html
to display.
If it can't find one, it will display a list of the contents of the folder.
You can specify which files you want Apache to use by adding this to your .htaccess
file:
DirectoryIndex something.php index.html index.phpApache will try each of the files you list, in the order you list them in, before giving up and displaying the list of files. If you want to disable the file list behavior completely, you can also add the following to your
.htaccess
:
IndexIgnore *
.htaccess
file:
AddType application/vnd.openxmlformats docx pptx xlsx
Purdue University, 610 Purdue Mall, West Lafayette, IN 47907, (765) 494-4600
© 2019 Purdue University | An equal access/equal opportunity university | Copyright Complaints | Maintained by Mechanical Engineering Technical Services
Trouble with this page? Disability-related accessibility issue? Please contact us at mecl@purdue.edu.