Apache Reference

.htaccess Simple 301 redirect using mod_alias

To do redirects in the Apache webserver you can of course use use mod_rewrite, but if you don't need a lot of complexity the simpler way to do it is to use mod_alias.

Documentation:

http://httpd.apache.org/docs/current/mod/mod_alias.html#redirect

Quick example - create a .htaccess and enter the following:

mod_rewrite IIRF Ionic Rewriter redirect to www

IIRF is a freely available isapi filter that allows you to do rewriting similar to mod_rewrite on IIS.

You can find iconic rewrite here : http://iirf.codeplex.com/

The following example has been tested on IIRF 1.2 and redirects all requests without the www. subdomain to the same url including the www subdomain :

the '301' is the redirect code used by IIS

Apache list all installed modules

To list all installed modules in Apache type the following command:

Apache Restart Apache webserver

The exact location of this command may vary (depending on your OS) but is typically found in /usr/sbin/

mod_rewrite enable mod_rewrite on apache2

to enable any module you can use the a2enmod command. To enable mod rewrite use the following:

.htaccess Quick password protection

.htaccess file:

mod_rewrite Single entry point for dynamic calls

Redirect all calls to dynamic content to index.php. Requests for static files are simply served as static files

Save the following in a .htaccess and save in root:

[x]