Forums / Setup & design / Multiple V-hosts with serverpaths?

Multiple V-hosts with serverpaths?

Author Message

Nicklas Lundgren

Sunday 18 January 2004 6:50:29 am

Hello,
I really would appreciate some help, regarding rewriterules for Apache.

I run three sites with ez 3.24 on the same server, using the same db.
When launching th sites, every site will get its own domain name. But until then, I use uri-matching to select between sites like:
localhost/index.php/site1
localhost/index.php/site2

However, the third site need multiple language support. And I have set up siteaccesses for this. So now I can reach the third site like this:
localhost/index.php/site3 for the swedish version and
localhost/index.php/site3_en for the english version.

To make the urls:s more intuitive, I want this to work:
localhost/index.php/site3/en for the english one.
And ultimately:
localhost/site3/en to work as well, without index.php.

When launching on the real server, I hope to get these URL:s to work:
www.site3.com for swedish pages and
www.site3.com/en for english pages.

Thats, it.
Has anyone done this before with rewriterules in Apache?

I would really appreciate any ideas on how to achieve this.

Regards,
Nicklas Lundgren

James Packham

Monday 19 January 2004 9:20:49 am

Hi, I think I understand you right.

Add entries for each of your domains like this:

<VirtualHost *:80>
<Directory /var/www/html/site3>
Options FollowSymLinks Indexes ExecCGI
AllowOverride None
</Directory>
RewriteEngine On
RewriteRule !\.(gif|css|jpg|png|jar|js|html)$ /index.php
DocumentRoot /var/www/html/site3
ServerName www.site3.com
</Virtualhost>

The rewriting bit is the "RewriteEngine On" and "RewriteRule !\.(gif|css|jpg|png|jar|js|html)$ /index.php" lines. This is whatever you want apache to assume, so in this example anything that comes in after www.site3.com will be rewritten as www.site3.com/index.php.

e.g. www.site3.com/en automatically becomes www.site3.com/index.php/en (although this won't appear in the user's browser). eZ Publish will do the rest of the translation, you can tell it how to respond to different incoming urls in /settings/override/site.ini.php.append (or whatever it was)

Hope this helps (this is all in the documentation by the way).

Regards,

James