: Rewriting isn't doing what's expected I've got a simple web.py application, running at Dreamhost. The .htaccess file, per the DH documentation is in the example.com home directory, not public:
I've got a simple web.py application, running at Dreamhost. The .htaccess file, per the DH documentation is in the example.com home directory, not public:
Options +ExecCGI
AddHandler cgi-script .py
DirectoryIndex index.py/
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /public/
RewriteCond %{REQUEST_URI} !^/favicon.ico$
RewriteCond %{REQUEST_URI} !^/static/(.*)$
RewriteCond %{REQUEST_URI} !^(/.*)+index.py/
RewriteRule ^(.*)$ /index.py/ [PT]
</IfModule>
When I try to access the page, however, I get
67.165.250.93 - - [12/Sep/2011:19:40:38 -0700] "GET /index.py/ HTTP/1.1" 200 678 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2"
67.165.250.93 - - [12/Sep/2011:19:40:39 -0700] "GET /index.py/static/reset.css HTTP/1.1" 404 255 "http://www.microscopy.salveteomnis.com/index.py/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2"
67.165.250.93 - - [12/Sep/2011:19:40:40 -0700] "GET /index.py/static/common.css HTTP/1.1" 404 256 "http://www.microscopy.salveteomnis.com/index.py/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2"
67.165.250.93 - - [12/Sep/2011:19:40:40 -0700] "GET /index.py/static/microscope-large.jpg HTTP/1.1" 404 256 "http://www.microscopy.salveteomnis.com/index.py/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2"
It's clear that this isn't being rewritten correctly -- the static contents should be /static/foo -- but I've been unsuccessful fixing the problem.
More posts by @Gloria169
1 Comments
Sorted by latest first Latest Oldest Best
The more I look at this the more I'm convinced that your problem is completely unrelated to the rewrite rule. The 5th and 6th fields of your log look like the actual request made by the client and the response code:
"GET /index.py/ HTTP/1.1" 200
"GET /index.py/static/reset.css HTTP/1.1" 404
"GET /index.py/static/common.css HTTP/1.1" 404
"GET /index.py/static/microscope-large.jpg HTTP/1.1" 404
So it's successfully getting /index.py/ and then requesting /index.py/static/reset.css. The obvious explanation for this is that the HTML returned for /index.py/ includes
<link type="text/css" rel="stylesheet" href="static/reset.css" />
when it should be
<link type="text/css" rel="stylesheet" href="/static/reset.css" />
PS Although one thing does strike me as odd about the rewrite rule. Are you sure the rule itself shouldn't be
RewriteRule ^(.*)$ /index.py? [PT]
?
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.