Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.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?

like image 873
kennySystemExit Avatar asked Dec 26 '14 13:12

kennySystemExit


People also ask

Why is my htaccess file not working?

Improper syntax being used It is quite common for a syntax error to be the reason for an . htaccess file not working. If you are familiar with how to read and configure . htaccess rules, double check your configuration.

Why my localhost is not working in xampp?

Resolve Apache port conflicts by changing your listening port to 8080. Include the listening port in the address when accessing localhost. Change your MySQL port to 3307 if another application is blocking the default port 3306.

Where is .htaccess file xampp?

htaccess file is usually present in your C:/xampp/htdocs/wordpress if you are in windows or /opt/lampp/htdocs/wordpress if you are on linux or mac if you can't find it simply... ( for Windows ) enable show hidden files in file manager...


1 Answers

You can use this rule in root .htaccess:

RewriteEngine On
RewriteBase /

RewriteRule ^locations(/.*)?$ test.php [L,NC]
like image 99
anubhava Avatar answered Sep 22 '22 20:09

anubhava