Sunday, January 16, 2011

.htaccess: Transparently adding a name to the request

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?

  • The syntax for RewriteCond uses regular expressions that are matched against some string. You are trying to use some x = y syntax that is completely unsupported.

    Thus your last three lines should look something like this:

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

    But please note that I only looked at the syntax and not the semantics of your rules.

    innaM : With what syntax? Mine or yours?
    innaM : I've removed the space between "NC," and "OR". The list of flags is comma-separated, not comma-space-separated.
    From innaM

0 comments:

Post a Comment