Welcome to MobyThreads.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Using RewriteBase

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  Apache: Exchancing characters in .htacess  
Author Message
alex

External


Since: Oct 16, 2007
Posts: 3



(Msg. 1) Posted: Tue Oct 16, 2007 12:18 pm
Post subject: Using RewriteBase
Archived from groups: alt>apache>configuration (more info?)

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.

 >> Stay informed about: Using RewriteBase 
Back to top
Login to vote
HansH

External


Since: Dec 08, 2006
Posts: 112



(Msg. 2) Posted: Tue Oct 16, 2007 12:30 pm
Post subject: Re: Using RewriteBase [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"alex" <me.DeleteThis@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

 >> Stay informed about: Using RewriteBase 
Back to top
Login to vote
alex

External


Since: Oct 16, 2007
Posts: 3



(Msg. 3) Posted: Tue Oct 16, 2007 12:37 pm
Post subject: Re: Using RewriteBase [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
 >> Stay informed about: Using RewriteBase 
Back to top
Login to vote
alex

External


Since: Oct 16, 2007
Posts: 3



(Msg. 4) Posted: Tue Oct 16, 2007 12:55 pm
Post subject: Re: Using RewriteBase [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.
 >> Stay informed about: Using RewriteBase 
Back to top
Login to vote
HansH

External


Since: Dec 08, 2006
Posts: 112



(Msg. 5) Posted: Tue Oct 16, 2007 1:34 pm
Post subject: Re: Using RewriteBase [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"alex" <me DeleteThis @privacy.net> 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
 >> Stay informed about: Using RewriteBase 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]