.htaccess file does not work on localhost XAMPP

I have a PHP project on localhost using XAMPP, and also a .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /locations/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /test.php [L]
</IfModule>

But this does not work, and I get 404 error. In the httpd.conf file, I uncommented this line:

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All

I am using Windows 8.1. What can I do to make it work, please?

+4
source share
2 answers

This rule can be used in the root directory .htaccess:

RewriteEngine On
RewriteBase /

RewriteRule ^locations(/.*)?$ test.php [L,NC]
+6
source

using XAMPP, you will find the file at:

{xampp_dir} /apache/conf/httpd.conf

Find the following line:

LoadModule modules rewrite_module / mod_rewrite.so

( "#" ). AllowOverride None AllowOverride All

+2

Source: https://habr.com/ru/post/1569052/


All Articles