How to avoid auto forwarding by XAMPP from http://localhost/ to http://localhost/xampp/ ?

After installation, XAMPP automatically forwards your requests for http://localhost/ to  http://localhost/xampp/. That means you can not access ‘http://localhost/’. You are always forwarded to http://localhost/xampp/.

The reason is, you are automatically forwarded to ‘/xampp/’ by the index.php located at your document root. If your document root is “C:/xampp/htdocs”, the index.php is located there. To fix the issue, simply rename index.php to anything you like, say xyz.php. You are done.

If you rename the index.php, index.html will be shown when you requests for http://localhost/. To access xampp use full URL like http://localhost/xampp/

Additionally if you like to automatically forwards your request from http://localhost/ to some other directory, like http://localhost/yoursite/ edit the line ‘header(‘Location: ‘.$uri.’/xampp/’);‘ line in index.php. (Don’t rename index.php in such case).

Leave a Reply