Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make default page home.php instead of index.html and index.php

Tags:

php

.htaccess

I have website http://mywebsite.com If I hit this URL it take index.php and index.html as default page. How can I make home.php as default page. I have tried this but not working by placing following code inside .htaccess file of public_html

DirectoryIndex home.php index.html index.php
like image 848
CodeManiac Avatar asked Apr 03 '13 05:04

CodeManiac


People also ask

Which php page is run by default?

As a rule the file called index is the default start page. This means that this page will be shown first when you access your domain, directly (www.example.com). Furthermore, index. php will always be shown before index.


2 Answers

You just need home.php in your DirectoryIndex to make it works. Remember that this is using in .htaccess file of your root project:

DirectoryIndex home.php
like image 160
Eli Avatar answered Oct 15 '22 01:10

Eli


You need AllowOverride +Indexes in your httpd.conf to be able to use DirectoryIndex in .htaccess.

Barring that, the absolutely easiest way to redirect (without the root access to Apache config and modules) is putting this as index.html:

<!doctype html>
<html>
  <head>
    <meta http-equiv="Refresh" content="0; url=home.php">
  </head>
  <body>
  </body>
</html>
like image 31
Amadan Avatar answered Oct 15 '22 02:10

Amadan