forked from seblucas/cops
-
Notifications
You must be signed in to change notification settings - Fork 7
Url Rewriting with COPS
Northguy edited this page Mar 21, 2024
·
12 revisions
The Kobo eReader Touch's browser cannot download through php file (the extension has to be known). To allow downloading on this eReader, you must enable Url Rewriting (cops_use_url_rewriting) in config_local.php
. Additionally, you might need to add some additional lines to the configuration of your http server.
- Nginx :
location /download/ {
rewrite ^/download/(\d*)/(\d*)/.*\.kepub\.epub$ /fetch.php?data=$1&db=$2&type=epub last;
rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /fetch.php?data=$1&db=$2&type=$3 last;
rewrite ^/download/(\d*)/.*\.kepub\.epub$ /fetch.php?data=$1&type=epub last;
rewrite ^/download/(\d+)/.*\.(.*)$ /fetch.php?data=$1&type=$2 last;
break;
}
location /view/ {
rewrite ^/view/(\d*)/(\d*)/.*\.kepub\.epub$ /fetch.php?data=$1&db=$2&type=epub&view=1 last;
rewrite ^/view/(\d*)/(\d*)/.*\.(.*)$ /fetch.php?data=$1&db=$2&type=$3&view=1 last;
rewrite ^/view/(\d*)/.*\.kepub\.epub$ /fetch.php?data=$1&type=epub&view=1 last;
rewrite ^/view/(\d*)/.*\.(.*)$ /fetch.php?data=$1&type=$2&view=1 last;
break;
}
-
Apache : Should work out of the box with the supplied .htaccess in versions of Apache below 2.3.9. For newer versions of Apache you need to change AllowOverride none to AllowOverride All in an Apache config file.
-
Cherokee (Thanks to Christophe) :
- Add a Behavior of type Regular Expression :
/cops/download/(.*)/.*\.(.*)$
- Choose the handler Redirection
- Add the substitution regexp :
/cops/download/(.*)/.*\.(.*)$" --> "/cops/fetch.php?data=$1&type=$2
- Add a Behavior of type Regular Expression :
-
Lighttpd (Nas4free) :
- you have to manually enter the url-rewriting rules from the webserver tab of the web gui. there is a "Auxiliary parameters" texbox in witch you have to enter this string (adjust the path for your specific case) :
url.rewrite-once = ("/cops/download/(.*)/.*\.(.*)$" => "/cops/fetch.php?data=$1&type=$2",
"^/cops/download/(\d+)/(\d+)/.*\.(.*)$" => "/cops/fetch.php?data=$1&db=$2&type=$3")