Share » Forums » Setup & design » Downloading a file with /version/ url...

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

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

Friday 01 September 2006 5:11:57 am - 8 replies

Author Message

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

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu