Configuring Apache HTTP to rewrite old OpenKM URL

This page contains obsolete information and will be removed in a near future.

In the case of having links in a document based on the old OpenKM version, these links by default will not work, because the format has changed.

For example, a link in version 6.4 may have this aspect "https://old.server.de/OpenKM/index.jsp?uuid=39448438-1f42-43fb-b33f-7b9ad5ac010c" to match with version 7.1.x should be converted to this one "https://new.server.de/openkm/kcenter/#/browser/uuid/39448438-1f42-43fb-b33f-7b9ad5ac010c".

Can use apache mod rewrite feature to convert the old URL to the new format, take the next configuration as a sample.

<VirtualHost *:80>
  ServerName new.server.de
  RedirectMatch ^/$ /openkm

  # WebSocket support - needs proxy-wstunnel
  ProxyPass /openkm/frontend/webSocket ws://127.0.0.1:8080/openkm/frontend/webSocket
  ProxyPassReverse /openkm/frontend/webSocket ws://127.0.0.1:8080/openkm/frontend/webSocket

  ProxyPass /openkm ajp://127.0.0.1:8009/openkm keepalive=On
  ProxyPassReverse /openkm http://new.server.de/openkm

  ErrorLog /var/log/apache2/openkm-error.log
  CustomLog /var/log/apache2/openkm-access.log combined


  ### sample configuration below ###

  RewriteEngine on
  RewriteCond %{HTTP_HOST} ^old\.server\.de$ // if condition needed, not mandatory
  RewriteCond %{REQUEST_URI} ^\/OpenKM\/index\.jsp$ // if condition needed, not mandatory
  RewriteCond %{QUERY_STRING} ^uuid=([\s\S]*)$ // condition is mandatory, checks if URL comes with uuid and stores only uuid in the variable %1.
  RewriteRule ^.*$ https://new.server.de/openkm/kcenter/#/browser/uuid/%1 [NE,L]  // NE-no-escape needed for hashtag, variable %1 with uuid added to the end.

  ###
</VirtualHost>

 

Table of contents [ Hide Show ]