Path

ez.no / exponential / documentation / configuration / configuration / tips & tricks / exclude uris from rewrite


Exclude URIs from rewrite

If you have set up virtual hosts and want to exclude certain URIs from the rewrite, e.g. for other scripts like a webmail script at http://www.example.com/webmail or a stats script at http://www.example.com/stats you can do the following.

In your httpd.conf rewrite rule use

RewriteRule !(^/stats/.*$|^/webmail/.*$|(gif|css|jpg|png|js|asf|avi|wmv|swf|xsl|jar))$ /<your path to>/index.php

for the above example URIs to be excluded from the rewrite.

You will need to avoid the words stats and webmail as first level nodes in your site when using url_alias (nice urls).

Thanks to Paul Borgermans

Comments

check for .htaccess

Running in virtual host setup, check for .htaccess file in the root folder of eZ. Remove it (or comment out ReWrite rules in it) to avoid unexpected access mistakes.

Rewrite conditions

Of course you can do a lot in the RewriteRule pattern, but it looks a bit simpler if you use the RewriteCond, which can specify which folder to exclude (and many more conditions):

RewriteCond %{REQUEST_URI} !^/(stats|webmail)/.*$
RewriteRule !\.(gif|css|jpg|png|js|asf|avi|wmv|swf|xsl|jar)$ /<your path to>/index.php

Error in virtual host code - dot missing

I think the code should have been:

RewriteRule !(^/stats/.*$|^/webmail/.*$|\.(gif|css|jpg|png|js|asf|avi|wmv|swf|xsl|jar))$ /<your path to>/index.php

There needs to be a dot before the (gif|css|...) etc, or Apache treats these as filenames rather than extensions, and most of the graphics/stylesheets on your site will disappear!

I'm a bit of a newbie, but just discovered this by trial and error...
- Chris

Log in or create a user account to comment.

Contents

Configuration

Configuration
    WebDAV setup
    Exponential running on a CGI version o...
    Path prefix
    Locale Settings
    Introduction
    Configuration files
    Site access
    Common settings
    Multi Site
    Directory structure
    Language and charset
    Cron jobs
    Login handler
    Search engine
    Tips & Tricks
       Manual "modfix"
       Several sites with one installation
       Enable / disable the setup wizard
       Determine if user has to log in
       Change the name of the main script
       Setting default page
       Setting the path to the var directory
       File permissions
       Defining design resources
       Exclude URIs from rewrite
Security
Optimization
Backup & Restore
Troubleshooting


Created

27/05/2003
3:33:39 pm
by Karsten Jennissen

Last updated

04/07/2003
3:35:45 pm
by B�rd Farstad

Authors

Karsten Jennissen
B�rd Farstad



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.