Setup mod-rewrite

Posted by Publiccert on Server Fault See other posts from Server Fault or by Publiccert
Published on 2012-04-15T19:34:17Z Indexed on 2012/04/15 23:32 UTC
Read the original article Hit count: 691

Filed under:

I'm trying to setup mod-rewrite for a few servers.

The code lives in /home/jeff/www/upload/application/

However, this is what's happening. It appears to be a problem with mod-rewrite since it's appending code.py to the beginning of the directory:

The requested URL /code.py/home/jeff/www/upload/application/ was not found on this server.

Here are the rules. Which one is the culprit?

WSGIScriptAlias / /home/jeff/www/upload/application
Alias /static /home/jeff/www/upload/public_html

<Directory /home/jeff/www/upload/application>
SetHandler wsgi-script
Options ExecCGI FollowSymLinks
</Directory>

AddType text/html .py

<Location />
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/static
RewriteCond %{REQUEST_URI} !^(/.*)+code.py/
RewriteRule ^(.*)$ code.py/$1 [PT]
</Location>
</VirtualHost>

© Server Fault or respective owner

Related posts about mod-rewrite