views:

195

answers:

2

I've read this tutorial about how to modify your .htaccess in order to server many web2py applications but it doesn't seem to work. Here is my .htaccess

RewriteEngine On

RewriteRule ^dispatch\.fcgi/ - [L]
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]

RewriteCond %{HTTP_HOST} =www.moublemouble.com [NC, OR]
RewriteCond %{HTTP_HOST} =moublemouble.com [NC]
RewriteRule ^/(.*) /moublemouble/$1 [PT,L]

All I get is a 500 Internal Error and .htaccess is not my strong point. Any clues?

+1  A: 

It might be your RewriteCond causing the problem.

I haven't tried it, but you could try...

RewriteCond %{HTTP_HOST} ^www.moublemouble.com [NC, OR]
RewriteCond %{HTTP_HOST} ^moublemouble.com [NC]
RewriteRule ^/(.*) /moublemouble/$1 [L]
danrichardson
didn't worked :(
Jon Romero
hmmm :( have you tried removing bits and by process of elimination, work out what's causing it to 500?
danrichardson
RewriteCond seems to be the error: 'RewriteCond: bad flag delimiters'
Jon Romero
+1  A: 

It’s either the illegal space in [NC, OR] or you are getting a recursion loop since the substitution /moublemouble/… is also matched by the pattern ^/(.*). So try this:

RewriteCond %{HTTP_HOST} =www.moublemouble.com [NC,OR]
RewriteCond %{HTTP_HOST} =moublemouble.com [NC]
RewriteCond $1 !^moublemouble/
RewriteRule ^/(.*) /moublemouble/$1 [PT,L]

Or more compact:

RewriteCond %{HTTP_HOST} ^(www\.)?moublemouble\.com$ [NC]
RewriteRule !^/moublemouble/ /moublemouble%{REQUEST_URI} [PT,L]
Gumbo
The first one doesn't throw an error (the error was due to the space between [NC, OR]) but it doesn't seem to work either
Jon Romero
@Jon Romero: Try it without the `PT` flag and with the `R` flag for debugging.
Gumbo