httpd.conf - Change default url php

99

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?

686

Answer

Solution:

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

Check out the docs.

965

Answer

Solution:

DirectoryIndex test.php

In your .htaccess or httpd.conf

243

Answer

Solution:

You could set the htaccessDirectoryIndex 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

People are also looking for solutions to the problem: Create PHP session for all users or only ones who want to log in?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.