The code modifications in this article allow to modify the displayed download path for the web browser, so it will display
Code: Select all
for the original filename of the file
meinegeheimenbilder.zip
instead of PHPWCMS standard
download.php?id=80162,28,1
the following link-
downloads/80162,28,1/meinegeheimenbilder.zip
PHPWCMS ist eine der besten CMSen weit und breit, einziger Nachteil war für mich bisher, dass Dateien zum Downloaden nicht in der Form
Code: Select all
meinegeheimenbilder.zip
sondern z.B:
download.php?id=80162,28,1
![Laughing :lol:](./images/smilies/icon_lol.gif)
![Laughing :lol:](./images/smilies/icon_lol.gif)
![Laughing :lol:](./images/smilies/icon_lol.gif)
Zunächst mal, wie schaut das ganze dann besser aus?
Code: Select all
Aus
meinegeheimenbilder.zip
bzw.
download.php?id=80162,28,1
wird
downloads/80162,28,1/meinegeheimenbilder.zip
Code: Select all
download.php?id=80162,28,1
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Achja noch kurz auf Voraussetzungen eingehen:
1. PHPWCMS ist in einem toplevel - Verzeichnis installiert (d.h. z.B.
Code: Select all
destiny.lavadots.com
und nicht
destiny.lavadots.com/mein/langer/pfad/phpwcms
2. Es wird kein Verzeichnis mit dem Namen downloads unter diesem toplevel Verzeichnis benutzt ... (wenn doch, dann ist es u.U. nach diesem Mod nicht mehr zugänglich)
the directory downloads won't be accessible if exists
Ok. Jetzt wirklich zum Code!
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Zunächst die .htaccess
Code: Select all
RewriteEngine on
#The holy grail code :-) Took me around two hours to figure out.
RewriteRule downloads/([^/]*)/.*$ /download.php?id=$1 [L]
#and now for the custom 404 doc
ErrorDocument 404 http://404.lavadots.com
Save this file as .htaccess to your root directory (where PHPWCMS should be located, see above! If not, it's easy to modify the approach.)
After this you also need to modify the
include/inc_front/content.article.inc.php
Search for fsize (part of a word, NOT whole word!)
look above for the following code-part
Code: Select all
"<a href=\"download.php?id=".$fxb[$key]["size"].",".$fxb[$key]["fid"].",".
$fxb[$key]["uid"]."\" title=\"download file ".
$fxb[$key]["fname"]."\" target=\"_blank\">".
Code: Select all
"<a href=\"downloads/".$fxb[$key]["size"].",".$fxb[$key]["fid"].",".
$fxb[$key]["uid"]."/" . $fxb[$key]["fname"] . "\" title=\"download file ".
$fxb[$key]["fname"]."\" target=\"_blank\">".
![Smile :-)](./images/smilies/icon_smile.gif)
Troubleshooting:
* Is PHPWCMS in the root directory of the domain / subdomain?
(Above has to be modified if not so)
* Your Provider may not support Mod_rewrite on apache ... try with a little .htaccess script like this
Code: Select all
RewriteEngine on
RewriteRule index.html index2.html [R,L]
![Smile :-)](./images/smilies/icon_smile.gif)
* This is only for your web downloads, NOT for the internal downloads after logging in (additional modification needs to be done for this.)
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)