Whats the use of BrowserMatch or Options All in .htaccess?

14,928
Options All
Options +FollowSymLinks

The Options tag specifies which features are available in a directory. In this case, it allows everything, but in case that doesn't do it, it's extra permitting following symlinks.

RewriteBase /

The RewriteBase tag is part of mod_rewrite and sets the root of later rewrite rules. This is completely superfluous.

BrowserMatch "MSIE" brokenvary=1
BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
BrowserMatch "Opera" !brokenvary

BrowserMatch is used to change behavior based on the user-agent string. It sets environmental variables that Apache uses. In this case it's working around some (old) broken HTTP/1.1 problems that IE and browsers that send an agent string with "Mozilla/4.xy" had. The last line tells the webserver that Opera behaves as expected, and to unset the environmental variable if it is present.

Share:
14,928

Related videos on Youtube

Såm
Author by

Såm

Updated on September 17, 2022

Comments

  • Såm
    Såm over 1 year

    I found these somewhere at the end of my htaccess file, from a time in history where I was in a mood of just adding as much as i could to my htaccess, now wishing the opposite: to remove everything thats unneeded from it, to make my site faster.

    Q1 Whats the function of these?
    Q2 Will my site become faster if i would delete these?

    Options All
    Options +FollowSymLinks
    RewriteBase /
    
    BrowserMatch "MSIE" brokenvary=1
    BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
    BrowserMatch "Opera" !brokenvary
    SetEnvIf brokenvary 1 force-no-vary[/i]
    
  • Såm
    Såm over 13 years
    Thanks very muuch Sysadmin 1138, clear explanation. But should I keep it, or delete this stuff in my htaccess? i heard namely, the more stuf fyou keep, the heavier / slower the server will respond... which rules might speed up when deleted / added?
  • Deb
    Deb over 13 years
    The Options one are the only ones I'd even consider keeping. The rest can be thrown over the side. Check your httpd.conf file to see if your locations have their options set there, so you don't have to do it in .htaccess