Aditya Shukla
Aditya Shukla

Reputation: 14235

Change default url php

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?

Upvotes: 2

Views: 2742

Answers (4)

Bailey Parker
Bailey Parker

Reputation: 15905

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

Upvotes: 1

profitphp
profitphp

Reputation: 8354

DirectoryIndex test.php

In your .htaccess or httpd.conf

Upvotes: 2

Pekka
Pekka

Reputation: 449613

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...

Upvotes: 0

jasonbar
jasonbar

Reputation: 13461

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

Check out the docs.

Upvotes: 3

Related Questions