Home > Groups > PHP developers > .htaccess problem with xampp

.htaccess problem with xampp

Article
Published in
mod_rewrite.JPG

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

  1. Go to xampp > apache > conf directory
  2. Search line #LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf file.
  3. Remove "#" from this line and now line is LoadModule rewrite_module modules/mod_rewrite.so
  4. Re-start xampp
  5. 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

Your rating: None Average: 3.4 (7 votes)

Bookmark and Share
Home Back To Top