server_snippet_apache.rb 941 B

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. # rubocop:disable Lint/MissingCopEnableDirective
  3. class KnowledgeBase
  4. class ServerSnippetApache < ServerSnippet
  5. def template_path
  6. <<~ERB
  7. # Add following lines to <VirtualHost> directive
  8. RewriteEngine On
  9. RewriteRule ^#{path}(.*) /help$1 [PT]
  10. ERB
  11. end
  12. def template_full
  13. <<~ERB
  14. # Add following lines to <VirtualHost> directive
  15. RewriteEngine On
  16. RewriteCond %{HTTP_HOST} #{host}
  17. RewriteRule (assets|api)/(.*) /$1/$2 [PT]
  18. RewriteCond %{HTTP_HOST} #{host}
  19. RewriteRule #{path}(.*) /help$1 [PT]
  20. ERB
  21. end
  22. def template_original_url
  23. <<~ERB
  24. # Add following lines to <VirtualHost> directive, before ProxyPass
  25. SetEnvIf Request_URI "(.*)" ORIGINAL_URL=$1
  26. RequestHeader add X-ORIGINAL-URL %{ORIGINAL_URL}e
  27. ERB
  28. end
  29. end
  30. end