Forum Archive - [Solved]Broken File Download Links

[Solved]Broken File Download Links
Jun 8, 2012 5:49 pm by mwangner
I am using Gtranslate Pro. It works very well for the website, but it is breaking links for downloadable files. For instance: http://www.aventuracctv.com/download/sp ... Series.pdf When browsing the spanish version of our website that link looks like this instead: http://www.aventuracctv.com/es/download ... Series.pdf Except it doesn't work (because there is no file there). I tried adding class="notranslate" to the <a href> statement but that didn't prevent gtranslate pro from rewriting the link. How can I solve this? Thanks!
Re: Broken File Download Links
Jun 8, 2012 9:03 pm by Yana
Hi, You can write a rule in your .htaccess to redirect links to the original language. Here is an example RewriteRule ^([a-z]{2})/download/(.*) /download/$2 [R=301,L]
Re: Broken File Download Links
Jun 11, 2012 2:55 pm by mwangner
There is no way to do this in the HTML or in the gtranslate code files? I am running on IIS 6.0 with a third-party redirect which is very difficult to understand (took us weeks to figure out how to do the gtranslate language redirects).
Re: Broken File Download Links
Jun 11, 2012 3:56 pm by Yana
Hi, You can convert it for IIS web.config.
Re: Broken File Download Links
Jun 11, 2012 6:23 pm by mwangner
What would the code be for web.config?
Re: Broken File Download Links
Jun 11, 2012 10:43 pm by Edvard
Can you please send the redirect rules you have created for GTranslate, so we can write the necessary code for you?
Re: Broken File Download Links
Jun 13, 2012 2:05 pm by mwangner
Absolutely, this is what I have now: <rewrite url="^(/.+(\.gif|\.png|\.php|\.swf|\.dwg|\.jpg|\.jad|\.cod|\.flv|\.mp4|\.xml|\.eps|\.css|\.html|\.ico|\.pdf|\.rtf|\.doc|\.css|\.zip|\.js)(\?.+)?)$" to="$1" processing="stop" /> <rewrite url="^/(af|ar|az|be|bg|bn|ca|cs|cy|da|de|el|en|es|at|eu|fa|fi|fr|ga|gl|gu|hi|hr|ht|hu|hy|id|is|it|iw|ja|ka|kn|ko|lt|lv|mk|ms|mt|nl|no|pl|pt|ro|ru|sk|sl|sq|sr|sv|sw|ta|te|th|tl|tr|uk|ur|vi|yi|zh-CN|zh-TW)?/(.*)$" to="/gtranslate/translate.php?lang=$1&amp;url=$2" processing="stop" /> <if url="^(.*)/(\?.+)?$"> <rewrite exists="$1/default.aspx" to="$1/default.aspx$2" /> <rewrite exists="$1/default.asp" to="$1/default.asp$2" /> <rewrite exists="$1/index.asp" to="$1/index.asp$2" /> <rewrite exists="$1/index.php" to="$1/index.php$2" /> </if> <unless exists="^(.+)$"> <rewrite url="^/(.+)/(.+)/" to="~/product/list.asp?subcatename=$1&amp;catname=$2" processing="stop" /> <rewrite url="^/(.+)/(\?(.+))?$" to="~/product/default.asp?catname=$1" processing="stop" /> </unless>
Re: Broken File Download Links
Jun 18, 2012 4:17 pm by mwangner
Edvard, do you have the code I would need to do this yet?
Re: Broken File Download Links
Jun 19, 2012 1:01 pm by Edvard
You need to add this before <rewrite url="^/(af|ar|az|... line: <redirect url="^/(af|ar|az|be|bg|bn|ca|cs|cy|da|de|el|en|es|at|eu|fa|fi|fr|ga|gl|gu|hi|hr|ht|hu|hy|id|is|it|iw|ja|ka|kn|ko|lt|lv|mk|ms|mt|nl|no|pl|pt|ro|ru|sk|sl|sq|sr|sv|sw|ta|te|th|tl|tr|uk|ur|vi|yi|zh-CN|zh-TW)?/download/(.*)$" to="/download/$2" /> For more info about redirect tag please check this: http://urlrewriter.net/index.php/suppor ... s/redirect
Re: Broken File Download Links
Jun 21, 2012 2:57 pm by mwangner
This works very well, thank you!
Re: [Solved]Broken File Download Links
Mar 6, 2015 3:44 pm by jasons
Hello - I have run into this same problem as well. Could someone send me the full code I need to place in the .htaccess file to get my PDF links to work?
Re: [Solved]Broken File Download Links
Mar 6, 2015 8:07 pm by Yana
Hi, Please send me the pdf file link example.
Re: [Solved]Broken File Download Links
Mar 6, 2015 9:49 pm by jasons
Yana - Here is the PDF link in English *removed link* Here it is in French *removed link* It works in English but not in any of the other languages. I noticed that it does this for all PDF's on my site. I am running the Pro version of GTranslate.
Re: [Solved]Broken File Download Links
Mar 7, 2015 8:31 pm by Yana
Hi, Here is the rule: RewriteRule ^([a-z]{2})/images/agenda/(.*) /images/agenda/$2 [R=301,L]
Re: [Solved]Broken File Download Links
Mar 10, 2015 1:47 am by jasons
Yana - Should this be placed in the .htaccess file?
Re: [Solved]Broken File Download Links
Mar 10, 2015 2:53 pm by Yana
Hi, Yes , you should put it after RewriteEngine On .
Re: [Solved]Broken File Download Links
Mar 10, 2015 4:40 pm by jasons
That worked, thanks Yana!
Re: [Solved]Broken File Download Links
Mar 13, 2015 12:22 pm by Yana
Good to hear that! You are welcome.

SIMILAR TOPICS

Add links to all translated posts on every Wordpress postJan 14, 2019 8:51 pmReplies: 5Post by: ptsniper
How to add rel="nofollow" to GTranslate links ?Sep 19, 2018 10:10 amReplies: 5Post by: agatti
How to emulate subdomain/language in .htacces fileAug 23, 2018 8:40 amReplies: 1Post by: ramyrickson
Changing Numbers and URL LinksJun 19, 2018 4:05 pmReplies: 1Post by: ryancomtek
Some URL translation brokenApr 14, 2017 1:10 pmReplies: 15Post by: avkeele

Try GTranslate with a free 15 day trial