if htaccess is not working on xampp then follow the steps
1) print phpinfo using code <?php echo phpinfo(); ?> in any php file
2) View above snapshot and find "mod_rewrite" inf phpinfo if you didn't find mod_rewrite then you have to follow below steps for enabling mod_rewrite
- Go to xampp > apache > conf directory
- Search line #LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf file.
- Remove "#" from this line and now line is LoadModule rewrite_module modules/mod_rewrite.so
- Re-start xampp
- Test again
3) Now mod_rewrite has enabled.
4) Create a php file "index.php"
5) Create a .htaccess file. if unable to create .htaccess file then copy and paste form other projects. or get from internet
6) Clear all the code from .htaccess and write below 2 lines in .htaccess file
RewriteEngine on
RewriteRule index index.php
These lines redirect index to index.php
ie. if you will open http://localhost/index then it will open http://localhost/index.php
Or if you will open http://example.com/index then it will open http://example.com/index.php
If above urls working that mean your .htaccess is working properly
