tags:

views:

6208

answers:

6

I installed XAMPP on my computer which is running Windows XP SP3.

Installation was successful.

I made a PHP file (index.php) and placed it in my htdoc folder and then tried to open http://localhost/index.php in my browser. It is automatically going to http://localhost/xampp instead. It is not opening index.php.

What have I done wrong?

A: 

make sure you have replaced the htdocs/index.php file the default htdocs/index.php file has code in it to redirect to /xampp

+2  A: 

REVISED:

The solution is still the same also after your comment: create a folder "myproject" under htdocs and place your index.php there. Surf to localhost/myproject and it works!

Did you try this?

And yes you are right, the index.html doesn't do anything. But there is also an index.php in the root folder which does the redirect.

Are you saying, you replaced this index.php with your own and there is still a redirect? Maybe a caching problem?

tharkun
A: 

@tharkun

but the index.html doesn't redirect to localhost/xampp, so how do you explain that ?

write this as acomment, not as an answer.
tharkun
commenting requires 50 reputation -- see faq
but you can edit your question, can't you?
tharkun
i didn't ask the question
I know, I meant you guys with low rep. :)
tharkun
+1  A: 

Locate the index.php file under c:\xampp\htdocs and rename it to index.php_initial, or delete it completely if you don't want to save it.

The httpd.conf file is setup to prioritize .php files, to put it simply. This is the best way to have it setup so don't bother trying to change it, just save your web documents as .php instead of .html. Even if you don't use PHP in your code, this will allow you to easily integrate php functions at a later date without having to worry about renaming your files.

Enjoy

+1  A: 

The index file does the redirect.

What I do is edit the X:/xampp/apache/apache.conf file to:

DocumentRoot "X:/xampp/htdocs/folderofyourchoice"

A: 

check if the name based url's are enabled. otherwise you can add more ips in your hosts file 127.0.0.1 this is localhost and redirects to the xampp folder just take the next ip

127.0.0.2 myothersite 127.0.0.3 myotherothersite ...

using the folder path in your url localhost/myfolder/public/index.php won't give you the all abilities of having own domain like url rewrite and can't ensure your site will work in every env.

eyurdakul