mikrobi/babel — Issue #43: Flexibility in .htaccess rules
Author: momon
Created: 2011-12-08 18:48:57+00:00
State: open

Hello, I've been having some issues with the .htaccess rules imposed by babel when working with other addons and I believe this could be avoided perhaps with more flexible rewrite rules or documentation which contemplate how to work around issues like the one I am having.

In specific I have issues with the Gmaps plugin at: http://modx.com/extras/package/gmaps

Basically the links within the maps are returning 404's because of the rewrite rules currently in place as required by babel. Here are my rewrite rules currently:

```
# detect language when requesting the root (/)
RewriteCond %{HTTP:Accept-Language} !^(en|es) [NC]
RewriteRule ^$ en/ [R=301,L]
RewriteRule ^$ es/ [R=301,L]

# Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^website\.com [NC]
RewriteRule (.*) http://website.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(es|en)/favicon.ico$ favicon.ico [L,QSA]

# redirect all requests to /de/assets* and /nl/assets* to /assets*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(es|en)/assets(.*)$ assets$2 [L,QSA]

# redirect all other requests to /de/* and /nl/* to index.php and set the cultureKey parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(es|en)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
```

coroico from the modx forums was kind enough to help me troubleshoot the issue, he is the author of the gmaps addon. He pointed our the following:

> When I write : http://urbeconstrucciones.com/index.php?id=50
> I get: http://urbeconstrucciones.com/es/ajaxinfobox.txt which is correct
>
> But when I write : http://urbeconstrucciones.com/index.php?id=50&mkrid=7
> I get : http://urbeconstrucciones.com/es/ajaxinfobox.txt which is not correct
> I awaited http://urbeconstrucciones.com/es/ajaxinfobox.txt?mkrid=7
>
>
> - http://urbeconstrucciones.com/es/ajaxinfobox.txt?mkrid=7
> I get the correct infowindow content:
>

Quattro por Urbe
> Calle Paseo de los Locutores No. 89
> en el Ensanche Quisqueya.

>
> - http://urbeconstrucciones.com/ajaxinfobox.txt?mkrid=7 gives the correct result
>
> - http://urbeconstrucciones.com/index.php?cultureKey=es&q=ajaxinfobox.txt&mkrid=7 give also the correct result
>
>
> I don't know why, but the mkrid parameter is lost when the rules of the htaccess are applied

The sample page I setup to try this out is at:

http://urbeconstrucciones.com/es/proyectos/proyectos-en-planos/torre-vulcana.html

You will see some marked places within the map, when you hover over them, the infobox pops up with the 404 error instead of the correct document as configured.

I appreciate any direction.

Thanks.