Skip to content
Browse files

Bug 9683: Allow disable rewrite apache mod

In Apache config koha-httpd.conf, URL-rewriting is enabled and does not
allow to disable mod_rewrite. Also, first rewriting rule
"RewriteRule (.+) $1?%1%2 [N,R,NE]" is enabled by default. This rule
rewrites nearly every URL. I propose to comment it in sources so that is
must be intentionally enabled.

This patch sets rewriting options into a conditional tag.

Test plan :
Test OPAC and intranet with and without mod_rewrite activated.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
The new Apache configuration seems to work fine (or at least as "fine"
as Apache gets) both with and without mod_rewrite enabled.
  • Loading branch information...
1 parent cb86132 commit b9c2c58fe601fe661e4111c5458d2e6bce64fc1a Fridolyn SOMERS committed with jcamins Feb 21, 2013
Showing with 27 additions and 21 deletions.
  1. +27 −21 etc/koha-httpd.conf
View
48 etc/koha-httpd.conf
@@ -82,18 +82,20 @@
ErrorDocument 404 /cgi-bin/koha/errors/404.pl
ErrorDocument 500 /cgi-bin/koha/errors/500.pl
-# Rewrite Rules
- RewriteEngine On
-
-# Uncomment to turn on rewrite logging
-# RewriteLog __LOG_DIR__/koha-opac-rewrite.log
-# RewriteLogLevel 1
- RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
- RewriteRule (.+) $1?%1%2 [N,R,NE]
-
- RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
- RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
- RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
+ <IfModule mod_rewrite.c>
+ # Rewrite Rules
+ RewriteEngine On
+
+ # Uncomment to turn on rewrite logging
+ #RewriteLog __LOG_DIR__/koha-opac-rewrite.log
+ #RewriteLogLevel 1
+
+ RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
+ #RewriteRule (.+) $1?%1%2 [N,R,NE]
+ RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
+ RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
+ RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
+ </IfModule>
</VirtualHost>
## Intranet
@@ -167,14 +169,18 @@
</IfModule>
</IfModule>
- RewriteEngine On
-# Uncomment to turn on rewrite logging
-# RewriteLog __LOG_DIR__/koha-intranet-rewrite.log
-# RewriteLogLevel 1
+ <IfModule mod_rewrite.c>
+ # Rewrite Rules
+ RewriteEngine On
+
+ # Uncomment to turn on rewrite logging
+ #RewriteLog __LOG_DIR__/koha-intranet-rewrite.log
+ #RewriteLogLevel 1
- RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
- RewriteRule (.+) $1?%1%2 [N,R,NE]
- RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT]
- RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
- RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
+ RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
+ #RewriteRule (.+) $1?%1%2 [N,R,NE]
+ RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT]
+ RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
+ RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
+ </IfModule>
</VirtualHost>

0 comments on commit b9c2c58

Please sign in to comment.
Something went wrong with that request. Please try again.