Downloading a file with /version/ url no longer works!

Author Message

Massimo Sanna

Friday 01 September 2006 5:11:57 am

Hi there,
I didn't change anything on the server since 2 weeks, but today without apparent reason, it stopped serving attached pdf files. Zip works as usual, but if I call a pdf file such as
http://www.cpl.it/content/download/1191/24242/version/5/file/Bilancio+CPL+CONCORDIA+2005+.pdf
...it gives me back an error, while if I try http://www.cpl.it/content/download/1191/24242/ it works as expected.
It never did such a thing, I don't know where to look, expecially since I didn't change anything on the server. Maybe some upload misconfigured something?
Where could I look for some ideas?
eZPublish's error log says nothing, debug output even less, httpd error.log has just these lines:
[Fri Sep 01 14:26:43 2006] [error] [client zzz.xxx.yyy.www File does not exist: /var/www/mysite/httpdocs/ez/content, referer: http://www.cpl.it/download

I'm going nuts... please help me... :(
Max

Massimo Sanna

Friday 01 September 2006 5:50:56 am

Well... I figured it out!
It was a rewrite rule problem :|
Some days ago I added a ^/ to the rewrite rules along with a xml extension to pass, because I'd like to serve a sitemap.xml to google sitemaps. Doing this screws up the downloads when ezpublish reaches the last / before the filename.

How can I serve a file called sitemap.xml from the root folder excluding it from being passed to index.php? I'm not really good with regexp...
Max

Claudia Kosny

Saturday 02 September 2006 6:43:02 am

Hello Massimo

Try to add a rewrite rule
RewriteRule ^sitemap\.xml$ - [L]
(which means: if the requested file is in the (rewrite-) root of the file and has the name sitemap.xml do not apply any rewriting to this page and skip all other rules that come after this one)
before the rule which redirects everything to the index.php

Don't forget to add the filename to the list of files allowed in the allow from all section like this:

<FilesMatch "(^sitemap\.xml$)|(index\.php|\.(gif|jpe?g|png|css|js|html)|var(.+)storage.pdf(.+)\.pdf)$">
order allow,deny
allow from all
</FilesMatch>

Greetings from Luxembourg

Claudia

Massimo Sanna

Monday 04 September 2006 3:26:57 am

Hi Claudia, thanks for your reply.
It looks like it doesn't work. These are my current rewrite rules. I think it's because the file is located in the root folder, so ^/ doesn't get bypassed. Files which are stored at a deeper level work fine instead,but I cannot store sitemap.xml in an internal folder, it must reside at the root level.

  RewriteEngine On
  RewriteRule ^/sitemap\.xml$ - [L]
  RewriteRule !(^/favicon.ico|^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages|^/packages|^/share/icons).*\.(gif|css|jpg|png|jar|js|ico|pdf|swf|htc)$ /index.php

I tried with/without trailing slash, almost every kind of combination, but I'm pretty clueless right now... I also tried to add it to my main rewrite rule, but the result is the same...
Any idea?

Xavier Dutoit

Monday 04 September 2006 8:38:01 am

Hi,

I've added (just after RewriteEngine On)

RewriteRule ^/robots.txt$ - [L]

and it serves the robots.txt that is in the root folder.

Could you test and see if it works for you and adapt it to your sitemap ?

X+

P.S. How do you generate the sitemap ? Do you know that you can serve it compressed to google ?

http://www.sydesy.com

Massimo Sanna

Monday 04 September 2006 12:06:44 pm

Well this is weird! ^/robots.txt$ works as expected, it shows me a text file within the browser.
^/sitemap.xml$ gives an eZ module not found error instead...
I know that i can submit a tar-gzipped sitemap to google, I was just trying the thing, generating the sitemap by hand with a standalone software on my client.
If I'll be able to get around this strange rewrite problem, I'm going to use sitemap_gen.py by google, with a cronjob to launch it automatically everyday.

Xavier Dutoit

Monday 04 September 2006 10:36:54 pm

weird indeed !

As for the sitemap, why don&#180;t you generate it directly with ez ?

You could then have more info about the content, like its real importance. I&#180;m sure you could get a better indexing with that.

X+

http://www.sydesy.com

Massimo Sanna

Tuesday 05 September 2006 1:27:18 am

Thanks a lot Xavier! I just didn't even think there was an extension to do this!
I installed "googlesitemaps", and created a virtual url within ez, so I didn't even have to copy sitemap.php in the root folder and modify the rewriterules.
It works like charm :)
www.cpl.it/sitemap.xml

Cheers, thanks again!
Max

Xavier Dutoit

Tuesday 05 September 2006 3:35:27 am

You're welcome.

That's the url Massimo mention:
http://ez.no/community/contribs/template_plugins/googlesitemaps_extension

I never took the time to test/use it, but I have the filling one can get a better indexing while using the priority tag.

I've often experienced than for rather short article body with a long intro, the parent node (the folder) is better indexed than the article pages itself and google tend to discard the article page as redondant.

By lowering the priority of the folders, I guess that you can change that and make the articles' pages more relevant.

If you're willing to experiment, you're more than welcome to share the results ;)

X+

http://www.sydesy.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 14:57:35
Script start
Timing: Jan 18 2025 14:57:35
Module start 'layout'
Timing: Jan 18 2025 14:57:35
Module start 'content'
Timing: Jan 18 2025 14:57:36
Module end 'content'
Timing: Jan 18 2025 14:57:36
Script end

Main resources:

Total runtime1.0824 sec
Peak memory usage4,096.0000 KB
Database Queries77

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 589.2891152.6563
Module start 'layout' 0.00530.0032 741.945339.4922
Module start 'content' 0.00851.0722 781.4375661.5156
Module end 'content' 1.08070.0017 1,442.953124.1250
Script end 1.0824  1,467.0781 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.3339160.0002
Check MTime0.00140.1265160.0001
Mysql Total
Database connection0.00090.083710.0009
Mysqli_queries0.992891.7229770.0129
Looping result0.00100.0922750.0000
Template Total1.051497.120.5257
Template load0.00250.234720.0013
Template processing1.048896.897620.5244
Template load and register function0.00010.008710.0001
states
state_id_array0.00180.170610.0018
state_identifier_array0.00100.088020.0005
Override
Cache load0.00230.2154770.0000
Sytem overhead
Fetch class attribute can translate value0.00060.054130.0002
Fetch class attribute name0.00120.1076110.0001
XML
Image XML parsing0.00120.112230.0004
class_abstraction
Instantiating content class attribute0.00000.0038170.0000
General
dbfile0.00160.1442220.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 48
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs