How to Configure Apache for Javascript

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
Apache Web Server configurations

JavaScript is used to create dynamic web pages that include pop up menus and animations on HTML pages. If the web pages are to be run on an Apache web server, then the Apache server needs to be configured for Server Side Includes (SSI). This functionality allow servlets or small server side code snippets to communicate with the browser programs called applets and can even be used to generate complete web pages. In Apache this functionality is enabled by editing the "httpd.conf" file.

Advertisement

Configuring httpd.conf

Video of the Day

Step 1

Fire up your Apache web server. Since the Apache web server comes as a bundle of other third-party server software in most cases, all you will need to do is fire up the bundled application to activate the Apache server inside.

Advertisement

Video of the Day

Step 2

Locate the server icon on the taskbar if you are using a local-based server. This icon will show all the services running. Click once to bring the menu and locate the Apache folder.

Step 3

Locate the server configuration folder if you are using a remote server. Locate the PHP folder which will contain the "httpd.conf" file.

Advertisement

Step 4

Search for the string "AddHandler" and re-write it to read this way:

AddHandler server-parsed .shtml

Step 5

Create a entry and enable the Includes feature as follows:

Advertisement

<Directory "/var/www">

Options Indexes Includes followSmyLinks AllowOverride All Order allow, deny Allow from all

Advertisement

Step 6

Ensure that all your files containing some JavaScript or a server-side include have an .shtml extension.

Step 7

Use the entry to allow for all web pages with a JavaScript include to be executed as follows:

Advertisement

DocumentRoot /var/www/eHow ServerName www.eHow.com XBitHack On ErrorLog logs/eHow_log CustomLog logs/eHow_log common

Step 8

Save all the changes and refresh the page to test.

Advertisement

Advertisement

references & resources

Report an Issue

screenshot of the current page

Screenshot loading...