Using RewriteBase

Using RewriteBase

am 16.10.2007 12:18:51 von Hans-Peter Sauer

I'm trying to get nice URLs working in a multi-language environment.

The base configuration of the site is like this.


DocumentRoot /opt/www/mysite
ServerName mysite
Alias /en /opt/www/mysite-en
Alias /es /opt/www/mysite-es


If i add Rewrite conditions in the VHost, the rewriting works for the
base site, but not for the localized sites (each of them have a urls
parsing script named url.php).



DocumentRoot /opt/www/mysite
ServerName mysite
Alias /en /opt/www/mysite-en
Alias /es /opt/www/mysite-es
RewriteEngine on
RewriteCond /opt/www/mysite/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.+) /url.php



So i've tried creating per-directory configurations:



DocumentRoot /opt/www/mysite
ServerName mysite
Alias /en /opt/www/mysite-en
Alias /es /opt/www/mysite-es

AllowOverride All


AllowOverride All




And in the .htaccess files located at the root of each aliased directory:

RewriteEngine On
RewriteBase /es
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.+) /url.php


i've tried several combinations as:

RewriteEngine On
RewriteBase /es
RewriteCond /opt/www/mysite-es/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.+) /es/url.php


But there is no rewriting going on. The .htaccess file seems being
parsed, as if i put gibberish in it, the server returns me an Internal
Server Error.

TIA,
alex.

Re: Using RewriteBase

am 16.10.2007 12:30:49 von HansH

"alex" schreef in bericht news:ff236c$h9r$1@aioe.org...
> i've tried several combinations as:
>
> RewriteEngine On
> RewriteBase /es
> RewriteCond /opt/www/mysite-es/%{REQUEST_FILENAME} !-f
> RewriteRule ^/(.+) /es/url.php
>
> But there is no rewriting going on.

In .htacces you should NOT attempt to match the leading /
Unsure about the leading path in the replacemant.

HansH

Re: Using RewriteBase

am 16.10.2007 12:37:37 von Hans-Peter Sauer

HansH wrote:
>
> In .htacces you should NOT attempt to match the leading /
> Unsure about the leading path in the replacemant.
>

I'm not sure if i completely understood this, but either

RewriteEngine On
RewriteBase es
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.+) es/url.php

or

RewriteEngine On
RewriteBase es
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.+) /url.php

or

RewriteEngine On
RewriteBase es
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.+) /es/url.php

give me an Internal Server Error

Re: Using RewriteBase

am 16.10.2007 12:55:17 von Hans-Peter Sauer

I've added rewrite logs, and this is an output for http://mysite/es/test/asd


192.168.6.2 - - [16/Oct/2007:12:52:19 +0200]
[mysite/sid#81642e8][rid#8384db0/initial] (2) init rewrite engine with
requested uri /es/test/asd
192.168.6.2 - - [16/Oct/2007:12:52:19 +0200]
[mysite/sid#81642e8][rid#8384db0/initial] (1) pass through /es/test/asd


directory "test" exists, but "asd" not, so the rewrite engine should be
triggered, but it passes through.

Re: Using RewriteBase

am 16.10.2007 13:34:52 von HansH

"alex" schreef in bericht news:ff249h$jqm$1@aioe.org...
>> In .htacces you should NOT attempt to match the leading /
>> Unsure about the leading path in the replacemant.
> I'm not sure if i completely understood this, but either
>
> RewriteEngine On
> RewriteBase es
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^/(.+) es/url.php
>
> give me an Internal Server Error
Drop the / at ther ule not the base
RewriteEngine On
RewriteBase /es
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+) /es/url.php
unsure about the last line, perhaps better
RewriteRule ^(.+) url.php

HansH