Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess not working on localhost with XAMPP

i m using XAMPP but i m not able to use .htaccess file at local host. i m trying so many times.. Online working good. but local host showing [The requested URL was not found on this server]

My root folder is real

localhost/acre/real/property_available.php
localhost/acre/real/properties


<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /acre/real/
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^properties$ /property_available.php/$1 [NC,QSA]
</IfModule>

Please

like image 282
acre Avatar asked Jun 18 '13 06:06

acre


People also ask

Can htaccess work on localhost?

htaccess style files are notoriously error prone and unreliable, they are hard to debug and really slow the server down. They are only offered for those users who do not have control over the host configuration (as it often is the case with cheap web space providers).

How do I open htaccess file in 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... (for linux) open terminal and type... Show activity on this post.

Why is .htaccess not working?

In order to verify this, you must open the Apache configuration file (typically either called httpd. conf or apache. conf ) and check that the AllowOverride directive is set to AllowOverride All . If you needed to make changes to your Apache config, remember to save the file and restart Apache.

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.


2 Answers

Just had a similar issue

Resolved it by checking in httpd.conf

     # 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   <--- make sure this is not set to "None" 

It is worth bearing in mind I tried (from Mark's answer) the "put garbage in the .htaccess" which did give a server error - but even though it was being read, it wasn't being acted on due to no overrides allowed.

like image 196
TimP Avatar answered Sep 19 '22 15:09

TimP


In conf/extra/httpd-vhosts.conf, add the line AllowOverride All for all the websites that you are having problem with

<VirtualHost example.site:80>
    # rest of the stuff
    <Directory "c:\Projects\example.site">
        Require all granted
         AllowOverride All <-----This line is required
    </Directory>
</VirtualHost>
like image 29
Hammad Khan Avatar answered Sep 21 '22 15:09

Hammad Khan