Alternative for Options MultiViews on new Apache

1.4k views Asked by At

i am using in htaccess

AcceptpathInfo On
Options MultiViews
MultiviewsMatch Handlers

to set pretty URL and something more. This set extension in filename as optional. For examle http://server.com/index will be the same as http://server.com/index.php (more useful it is in robots.txt.php, style.css.php and more). But after update to new version of XAMPP (Apache 2.4.10 and PHP 5.6.3) it doesn´t work (error 403), but in older XAMPP it works. Do you know about any alternative for this or how to set it? Error is at line

Options MultiViews
1

There are 1 answers

0
Jon Lin On BEST ANSWER

Actually, noticed something that may address your problem. So, with apache 2.4, you need a + or - in front of each option, so you need:

Options +Multiviews

If that still doesn't work, maybe mod_rewrite can do it (but you need to try each extension). Something like:

RewriteEngine On

# check for PHP extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.*)$ /$1.php [L]

# chek for HTML extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^(.*)$ /$1.html [L]

etc. for each extension you want to check for.