URL encoding and other hackery
Adam Doppelt
amd at urbanspoon.com
Sun Feb 17 21:24:45 MSK 2008
Igor Sysoev wrote:
>> later. I want to use something like this:
>>
>> if (-f $document_root/$uri)
>>
>
> You should use $request_filename instead: - it's "$document_root$uri".
> However, $request_filename correctly handle "root" as "alias".
>
I'm looking for a flavor of $request_filename that includes query
arguments, so that I can cache a version of the page that includes the
arguments. At the very least, I need to differentiate between a version
WITH arguments and a version WITHOUT arguments. I don't want those two
requests to serve up the same page. This is very important for SEO
purposes, to avoid duplicate content being shown at two different urls.
I could use this:
if (-f $document_root/$request_uri)
But there are escaping issues. Perhaps nginx needs something like this:
$request_filename_with_args
>> 2) Can I URL encode a variable?
>>
>
> I do not understand the question.
>
Another solution to my problem would be something like:
set $path url_escape($request_uri)
if (-f $document_root/$path) {
...
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080217/5fae9dd2/attachment.html>
More information about the nginx
mailing list