1

I have a root folder and I have created a sub folder as admin. When ever I type url as http://localhost/website/admin/ it is showing all files present in the directory. I don't want that particular folder instead I want default as login page. How can I do that.

I want output like : http://localhost/website/admin/login.php as default page instead of http://localhost/website/admin/

Gowtham
  • 35
  • 6

1 Answers1

0

Method 1

Use DirectoryIndex in .htaccess. Firstly create file named .htaccess in the /website/admin folder. And add this line to the .htaccess file.

DirectoryIndex login.php

Method 2

Create index.php in the /website/admin folder. And redirect to login.php using it.

<?php
  header('Location: http://example.com/website/admin/login.php');
?>
TheMisir
  • 4,083
  • 1
  • 27
  • 37