|
Home > Archive > Apache Server configuration support > October 2007 > Using RewriteBase
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| I'm trying to get nice URLs working in a multi-language environment.
The base configuration of the site is like this.
<VirtualHost *:80>
DocumentRoot /opt/www/mysite
ServerName mysite
Alias /en /opt/www/mysite-en
Alias /es /opt/www/mysite-es
</VirtualHost>
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).
<VirtualHost *:80>
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
</VirtualHost>
So i've tried creating per-directory configurations:
<VirtualHost *:80>
DocumentRoot /opt/www/mysite
ServerName mysite
Alias /en /opt/www/mysite-en
Alias /es /opt/www/mysite-es
<Directory "/opt/www/mysite-en/">
AllowOverride All
</Directory>
<Directory "/opt/www/mysite-es/">
AllowOverride All
</Directory>
</VirtualHost>
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.
| |
|
| "alex" <me@privacy.net> 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
| |
|
| 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
| |
|
| 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.
| |
|
| "alex" <me@privacy.net> schreef in bericht news:ff249h$jqm$1@aioe.org...
> 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
|
|
|
|
|