Skip to content

Url Rewriting with COPS

Volumes/Data/Backup/iBook/Shared/Trash/marioc.jpg edited this page Apr 27, 2017 · 11 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).

  • Nginx :
      location /download/ {
          rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /fetch.php?data=$1&db=$2&type=$3 last;
          rewrite ^/download/(\d+)/.*\.(.*)$ /fetch.php?data=$1&type=$2 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
  • 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")
Clone this wiki locally