Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Disabled MultiViews in .htaccess #784

Closed
wants to merge 1 commit into from
Closed

Conversation

florianv
Copy link
Contributor

The MultiViews option enables Apache to negotiate and serve existing files depending on the request Accept header. For example /config/test will resolve to /config.php/test when accepting text/html.

So it prevents from using route paths beginning with the name of a file present in the /web folder. Moreover, this option is not needed because all requests that don't match an existing file are meant to pass through the Symfony front controller.

So this PR removes this option from the .htaccess. Note that it is enabled in the default Apache configuration on Ubuntu.

This issue was also a topic here symfony/symfony-docs#3674

@@ -5,6 +5,10 @@
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
DirectoryIndex app.php

# Disable the MultiViews option preventing from using route paths beginning with
# "/app", "/app_dev" or "/config".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve to the front controller "/app.php" but be rewritten to "/app.php/app"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it's better

@florianv florianv force-pushed the multiviews branch 2 times, most recently from 2c950a9 to 0d2bd63 Compare February 17, 2015 22:11
@Tobion
Copy link
Contributor

Tobion commented Feb 17, 2015

I would not nest it inside mod_rewrite. Even if mod_rewrite is not enabled, "/app" is not the same as "/app.php" in symfony terms.

@florianv
Copy link
Contributor Author

Thanks for reviewing @Tobion. Fixed

@Tobion
Copy link
Contributor

Tobion commented Feb 17, 2015

👍

@fabpot
Copy link
Member

fabpot commented Feb 18, 2015

Thank you @florianv.

@fabpot fabpot closed this in 7658f94 Feb 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants