开发者

Url Rewrite With Python Paste

开发者 https://www.devze.com 2023-02-26 06:18 出处:网络
I\'m hosting a Pylons application using Apache as a proxy to paste, which serves my app. I\'m trying to set up a Rewrite Rule to force browsers to update modified css, js, and image files, as inspired

I'm hosting a Pylons application using Apache as a proxy to paste, which serves my app. I'm trying to set up a Rewrite Rule to force browsers to update modified css, js, and image files, as inspired by the latter half of section 10.8 in Chapter 10: Survive the Deep End. It works by writing a view helper to automatically include the modification time of any of these files in the url, so the html may look like this:

<link href="/css/main.1302802028.css" media="all" rel="stylesheet" type="text/css" />

Then, you use Rewrite Rules to get the server to forward the request to the location of the actual file at /css/main.css. That way, anytime you update your file the client's browser thinks it's getting a new file, thus ignoring its cache.

I tried setting it up in my site's conf file within apache with a rewrite rule like so:

RewriteEngine On
RewriteRule ^(.*)(css|img|js)/(.+)\.(\d+)\.(css|js|jpg|gif|png)$ $1$2/$3.$5 [L]

However, the Rewr开发者_高级运维ites don't seem to function since I'm using Apache with ProxyPass. Is there either a way to get them to work with a proxy, or use paste/pylons to achieve the same effect?

Thanks!


I don't know if you are running on top of Linux or not, but have you simply tried setting up a symlink?

0

精彩评论

暂无评论...
验证码 换一张
取 消