Skip to content

Instantly share code, notes, and snippets.

@n9986
Last active December 11, 2015 21:59
Show Gist options
  • Save n9986/9488026f5cefd8ccee3c to your computer and use it in GitHub Desktop.
Save n9986/9488026f5cefd8ccee3c to your computer and use it in GitHub Desktop.

According to the docs, an internal redirect causes the ruleset process to be run again.

That is what [L] is supposed to stop from happening. But docs say that this cannot always be prevented and we shouldn't rely on this flag entirely to stop this.

Currently what is happening is:

  • The Symfony 2.0 .htaccess's RewriteCond is accepted and an INTERNAL REDIRECT happens...
  • The Symfony 1.4 .htaccess's RewriteCond is accepted and another INTERNAL REDIRECT happens...
  • The same .htaccess is evaluated again and this time the RewriteCond fails and the previously selected rewrite is PassThrough'ed...

What we want to do is make the 3rd step happen at 2nd itself and let the 1st rewrite rule passthrough. For this, you might want to add a condition in the Symfony v1.4 .htaccess file to prevent this from happening.

So if the request is for app.php, do not handle ruleset for index.php (this applies for the rewritten request as well, because that is what the internal redirect is pointing to).

Something like: RewriteCond %{REQUEST_URI} !=/app.php (Or something equivalent that makes sure when app.php is at the end of the request skip everything and ignore all rewrite rules, I think it will actually be =D:/wamp/www/wlnew/web/wamp on right hand side since that is where the second match happens in your logs and you are using REQUEST_FILENAME). This RewriteCond needs to be correct.

I am pretty sure [INTERNAL REDIRECT] is the culprit here and we need to stop the 1.4 .htaccess from executing anything at all. I am sorry but I don't have access to a proper machine to test out the theory that I am imposing on you. If you can test it out right now that would be great. If it doesn't work, we try something else.

For reference regarding this theory:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment