Configuring Alias module using .htaccess directives

NB! Using .htaccess file directives instead of per-server rules (in the Apache configuration file) is NOT recommended by us. While URL manipulations in per-server context are really fast and efficient, per-directory rewrites are slow and inefficient - use them at your own risk. 

  1. Install Apache URL Rewrite Engine module (mod_rewrite), see: http://httpd.apache.org/docs/mod/mod_rewrite.html.

  2. Open the .htaccess file in your website folder and add following lines:

########### Rewrite rules for Alias module in .htaccess file
# NB! using .htaccess file instead of per-server rules is NOT recommended,
# per-directory rewrites are slow and inefficient.
<Files *>
  RewriteEngine On
  Options +SymLinksIfOwnerMatch

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_URI} !^/admin(/.*)
  RewriteCond %{REQUEST_URI} !^/classes(/.*)
  RewriteCond %{REQUEST_URI} !^/editor(/.*)
  RewriteCond %{REQUEST_URI} !^/extensions(/.*)
  RewriteCond %{REQUEST_URI} !^/idcard(/.*)
  RewriteCond %{REQUEST_URI} !^/js(/.*)
  RewriteCond %{REQUEST_URI} !^/public(/.*)
  RewriteCond %{REQUEST_URI} !^/px(/.*)
  RewriteCond %{REQUEST_URI} !^/px_custom(/.*)
  RewriteCond %{REQUEST_URI} !^/shared(/.*)
  RewriteCond %{REQUEST_URI} !^/styles(/.*)
  RewriteCond %{REQUEST_URI} !^/map
 RewriteRule ^(.*)$  /map.php?mod_rewrite=/&cmd=$1 [L,QSA]

  #Note: commands RewriteLogLevel and RewriteLog are not allowed in the .htaccess
</Files>
########### / Rewrite rules for Alias module
 

 

Note:  In case you have any extra directories or files under your website root directory, which are not part of the CMS installation, you should exclude them in the alias configuration.
Add following lines for each directory or file:

RewriteCond %{REQUEST_FILENAME} !^/notcmsdir

Note: If your website is located in the sub-directory, eg http://www.yoursite.com/mysite/ then the sub-directory string must be added to the rewrite conditions:

 

########### Rewrite rules for Alias module in .htaccess file
# NB! using .htaccess file instead of per-server rules is NOT recommended,
# per-directory rewrites are slow and inefficient.
<Files *>
  RewriteEngine On
  Options +SymLinksIfOwnerMatch

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_URI} !^/mysite/admin(/.*)
  RewriteCond %{REQUEST_URI} !^/mysite/classes(/.*)
  RewriteCond %{REQUEST_URI} !^/mysite/editor(/.*)
  RewriteCond %{REQUEST_URI} !^/mysite/extensions(/.*)
  RewriteCond %{REQUEST_URI} !^/mysite/js(/.*)
  RewriteCond %{REQUEST_URI} !^/mysite/public(/.*)
  RewriteCond %{REQUEST_URI} !^/mysite/px(/.*)
  RewriteCond %{REQUEST_URI} !^/mysite/px_custom(/.*)
  RewriteCond %{REQUEST_URI} !^/mysite/shared(/.*)
  RewriteCond %{REQUEST_URI} !^/mysite/styles(/.*)
  RewriteCond %{REQUEST_URI} !^/mysite/map
  RewriteRule ^(.*)$  /mysite/map.php?mod_rewrite=/mysite/&cmd=$1 [L,QSA]

  #Note: commands RewriteLogLevel and RewriteLog are not allowed in the .htaccess
</Files>
########### / Rewrite rules for Alias module

Configuration

Configuring Alias module / Configuring Alias module using .htaccess directives / Optimising site performance / Site cache / Page compression / How to send error messages to e-mail? / How to redirect root domain to www subdomain?