D
D
Dmitry Maslennikov2017-04-11 15:35:49
Apache HTTP Server
Dmitry Maslennikov, 2017-04-11 15:35:49

How to make .htaccess work in Apache 2.4 (mod_rewrite)?

Updated Apache to version 2.4, mod_rewrite stopped working. What needs to be changed in the file to make it work with the new version of Apache?
The .htaccess file itself:

AddDefaultCharset utf-8
php_value upload_max_filesize 50M
php_value post_max_size 50M
php_value max_execution_time 10800
php_value max_input_time 10800
php_value date.timezone UTC
DirectoryIndex index.php
RewriteEngine On
RewriteBase /
Options -ExecCGI -Indexes -Includes +FollowSymlinks*
RewriteCond(%.^HTTP) $ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php [L]

In the last lines - there is a redirect to the index file, which does the full parsing of the URL. Previously, this configuration worked fine on different systems.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Maslennikov, 2017-04-11
@aprenoir

Everything turned out to be simple, in the site directory we prescribe:
Options Indexes FollowSymLinks
Require all granted
AllowOverride All
The htaccess file itself does not need to be changed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question