2

How to change the default url. eg www.example.com/index.php -> www.example.com

now i want to set it to www.example.com/test.php. Should i make changes in php.ini?

4
  • That is taken care of in your web server not in PHP. Are you using Apache or something else? Commented Jan 13, 2011 at 22:22
  • The easiest way would be to create a link I guess. Commented Jan 13, 2011 at 22:23
  • yes i am using apache.Is there a config file for it? Commented Jan 13, 2011 at 22:23
  • yes, it's usually named httpd.conf Commented Jan 13, 2011 at 22:24

4 Answers 4

3

Assuming you are using apache, you can do this through the DirectoryIndex directive.

Check out the docs.

Sign up to request clarification or add additional context in comments.

Comments

2
DirectoryIndex test.php

In your .htaccess or httpd.conf

Comments

1

You could set the htaccess DirectoryIndex to include test.php:

DirectoryIndex test.php index.php index.html

You could also setup a redirect from index.php:

header('Location: test.php'); //Must be before any content is sent out

Redirects will work from htaccess too:

Redirect 301 index.php test.php

The simplest thing to do, however, would be renaming the test.php file to index.php. Why not just do that? :P

Comments

0

You would have to change this in Apache's configuration using the DirectoryIndex directive.

e.g. (In the correct VirtualHost section):

DirectoryIndex test.php 

Although I can't see why on earth one would want to do that...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.