Share » Forums » Install & configuration » Apache config for eZ hostname access...

Apache config for eZ hostname access & other apps?

Apache config for eZ hostname access & other apps?

Friday 02 February 2007 7:22:27 am - 4 replies

Author Message

Kim Johansen

Monday 05 February 2007 12:01:16 am

Check apache error-log and rewrite-log to see whats happening.

You can find more about the vhost-configuration here: http://ez.no/doc/ez_publish/technical_manual/3_8/installation/virtual_host_setup

Try out Free eZ Publish 4.0 Trial Hosting for 14 days:
http://webdealhosting.com/ez-publish-trial-hosting

High quality eZ Publish Hosting since 2001!

Mike Machnik

Wednesday 07 February 2007 9:09:38 am

Thank you...the rewrite log did help. Here is what works now: add these three lines to the VirtualHost:

Alias "/test" "/home/user1/public_html/test"

RewriteRule ^/test/(.*)$ /test/$1 [L,PT]
RewriteRule ^/test$ /test/ [R=301,L]

I took out my .htaccess changes, not needed. I only needed the above three lines in VirtualHost.

Hope this helps someone else too...

Timmothy Green

Wednesday 07 February 2007 12:37:27 pm

I have used the following method to accomplish this:

Alias "/test" "/home/user1/public_html/test"

RewriteEngine On
RewriteCond  %{REQUEST_URI}   !^/test/(.*)$
    RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages).*\.(gif|css|jpg|png|jar|js|ico|swf|wmv)$ /index.php

This instructs Apache to apply the RewriteRule to the requested URL as long as it does not contain "/test/". It essentially bypasses the RewriteRule based on whatever condition you choose.

End result is the same but I thought I would share another option.

Automation Technologies, Inc.
http://www.ati4it.com

Linh Vu

Wednesday 07 February 2007 5:39:40 pm

Just throwing in my 2c...

I use the same method as Tim's, although the (.*) is not necessary and using a catch-all wildcard in regex is generally not recommended unless you want a wholesale redirection.

Mike's method works but is not safe both because of Apache's internal order of processing rules (Redirect, Alias, Rewrite and ScriptAlias - note: not in this order, just a list). You can easily run into problems if you rely on this, so it's best to be specific and tell ezPublish, via a RewriteCond, not to process those folders.

Here's my general ezPublish Apache config:

    ServerName example.com
    ServerAlias www.example.com admin.example.com

    RewriteEngine On
    # no-www
    RewriteCond %{HTTP_HOST} ^www.example.com$
    RewriteRule ^/?(.*) http://example.com/$1 [R=301,L]

    # eZ publish
    # Excluding custom app folders
    RewriteCond %{REQUEST_URI} !(^/app1|^/app2|^/app3) [NC]
    RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages|^/packages|^/share/icons).*\.(gif|css|htc|jpg|png|jar|js|ico|pdf|swf)$ /index.php [L]

If I had more time, I would write less code.

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu