1
I saw a code .htaccess
in the Laravel Framework, whose code snippet had this:
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
What would that be -MultiViews
?
What does he do?
1
I saw a code .htaccess
in the Laravel Framework, whose code snippet had this:
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
What would that be -MultiViews
?
What does he do?
2
This is an Apache content negotiation rule.
The Multiviews enabled for your application, hides the extension of a file assuming it is a directory.
Below are examples of how the feature is used when running on your site:
In the example below with the Multiview (disabled) you access your website files nome_do_arquivo.extensão
www.seusite.com.br/index.php
With the resource of Multiview (enabled) your files such as nome_do_arquivo.extensão
stays nome_do_arquivo
, in this case by hiding the extension, as in the example below:
www.seusite.com.br/index
To enable the function:
Options +MultiViews
To disable the function:
Options -MultiViews
Note: In Apache configuration, use
Options All
does not enable the optionMultiViews
by default. The same should be done manually if desired.
According to official documentation, the effect of MultiViews
is as follows: if the server receives a request for /some/dir/foo
, if /some/dir/
has the option MultiViews
empowered, and /some/dir/foo
does not exist, then the server will read the directory looking for files named with foo.*
, effectuating a type map that names these files, assigning them the same types of media and encoding that would have if the client had requested the file by name. Then the server chooses the best match to the request requirements.
Sources: Locaweb, Official documentation
1
When Multiviews is enabled in your application, this will hide the file extension. Below are some examples of how the resource is used on your site:
1) In the example below with Multiviews (disabled) you will access the site files as: filename.
www.seusite.com.br/index.php
2) With the Multiviews feature (enabled) the site files as filename.extension will be named filename, in this case hiding the extension as in the example below:
www.seusite.com.br/index
Browser other questions tagged htaccess
You are not signed in. Login or sign up in order to post.