kennySystemExit
kennySystemExit

Reputation: 329

.htaccess file not working on localhost XAMPP

I have PHP project on localhost using XAMPP and also .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 is not working and I am only getting Error 404. In httpd.conf file I have 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?

Upvotes: 5

Views: 15294

Answers (2)

anubhava
anubhava

Reputation: 784898

You can use this rule in root .htaccess:

RewriteEngine On
RewriteBase /

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

Upvotes: 7

Javed Alam
Javed Alam

Reputation: 81

using XAMPP then you will find the file at:

{xampp_dir}/apache/conf/httpd.conf

Search for the following string:

LoadModule rewrite_module modules/mod_rewrite.so

and uncomment it (remove the ‘#’ sign). Now search for another string AllowOverride None and replace it by AllowOverride All

Upvotes: 2

Related Questions