Skip to the content
Documentation

Mistake in last rewrite rule

No ratings yet

When I tried the rewrite rules above, Apache (2.0.54) complained with "mod_rewrite: maximum number of internal redirects reached", resulting in a 500 error.
The solution is that the last rewrite rule should read:
RewriteRule .* index.php # no leading slash
See http://www.sitepoint.com/print/mod_rewrite-no-endless-loops for an explanation.
By the way, this VirtualHost setup is quite differet to those in the .htaccess_root file that shops with ez Publish 3.7.2 - would you recommend a selective merge of the two or to stick to this example?

Comments (2 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Re: Mistake in last rewrite rule

    Karl Hegbloom ·

    My site logo image did not appear, so I have also added, before the final rule:

         Rewriterule \.(gif|jpe?g|png|css|js|html)$ - [L]     # RewriteCond %{HTTP_HOST} ^webdav\..*     # RewriteRule ^(.*) /webdav.php [L]     # RewriteCond %{HTTP_HOST} ^soap\..*     # RewriteRule ^(.*) /soap.php [L]
  2. Re: Mistake in last rewrite rule

    Björn Dieding ·

    RewirteOptions are not the way to go they are deprecated
    for .htaccess usage you can't your this rules from this vhost
    They should look more like this

    DirectoryIndex index.phpRewriteEngine OnRewriteCond %{HTTP_HOST} ^webdav\..*RewriteRule ^(.*) webdav.php [L]RewriteCond %{HTTP_HOST} ^soap\..*RewriteRule ^(.*) soap.php [L]RewriteRule ^var/cache/debug.html.* - [L]RewriteRule ^var/[^/]+/cache/debug.html.* - [L]Rewriterule ^var/storage/.* - [L]Rewriterule ^var/[^/]+/storage/.* - [L]RewriteRule ^var/cache/texttoimage/.* - [L]RewriteRule ^var/[^/]+/cache/texttoimage/.* - [L]Rewriterule ^design/[^/]+/(stylesheets|images|javascript)/.* - [L]Rewriterule ^share/icons/.* - [L]Rewriterule ^extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.* - [L]Rewriterule ^packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]RewriteRule .* index.php [L]