Solved

index.php automatic loading.

Posted on 2014-10-20
4
85 Views
Last Modified: 2015-01-25
Hello,
I have some folder in which I have index.php.

when I open site
mydomain.com/home

I want browser automatically open
mydomain.com/home/index.php

Is adding
DirectoryIndex index.php
on apache's virtualhost configuration
enough?

Also I have to manually write index.php for signing into phpMyAdmin.

What can cause such behaviour and how to override it?

Best Regards,
Nusrat
0
Comment
Question by:Nusrat Nuriyev
4 Comments
 
LVL 10

Accepted Solution

by:
JEaston earned 167 total points
ID: 40391732
I don't use Apache much, but I believe you should have a single DirectoryIndex line which lists the pages you want as defaults.  For example:
DirectoryIndex index.html index.htm default.htm index.php

Open in new window


Likewise the virtual host confirm for your phpMyAdmin will also need the index.php in the directory index.
0
 
LVL 16

Assisted Solution

by:Chris Harte
Chris Harte earned 167 total points
ID: 40391745
Along side my directoryIndex in my conf file I also have

##LoadModule php5_module php5apache2.dll
AddType application/x-httpd-php .php


I also have this in httpd.conf, which is the path to my phpMyAdmin directory

<IfModule mod_alias.c>
     Alias /phpMyAdmin "C:/utils/apache/htdocs/phpMyAdmin"
</IfModule>

It has been a long time since I set up an apace server, but it works so I imagine both of these are necessary.
0
 
LVL 11

Assisted Solution

by:Murfur
Murfur earned 166 total points
ID: 40395022
As @JEaston said, you can add the DirectoryIndex statement to the virtual host .conf file but to add a small caveat, please note that Apache will load the files in the order they are written so if you also happen to have one of the other files e.g. default.htm then index.php will never get loaded unless you call it specifically in the URL. To be safe, delete the other files if they exist and only list one index file in the DirectoryIndex statement to reduce chances of an error if one of the other files has been uploaded by mistake - it happens!

Alternatively you can create (or edit if it already exists) a file called .htaccess (note the starting dot) in the site site root and put the DirectoryIndex index.php statement there.

An .htaccess file can do pretty much all that the .conf file can do but the big advantage of the .htaccess file is that the effect is immediate whereas any changes to a .conf file will require a restart of the Apache service.
This is particularly useful if you do not have access to the site .conf files or to the httpd service control, or you do but you don't want to share those permissions with your developers.

Same story with phpMyAdmin - if you have access to the directory then add the .htaccess file as the phpMyAdmin is usually an alias that will most liekely be found in the main httpd.conf
0
 

Author Comment

by:Nusrat Nuriyev
ID: 40448601
thanks! will try htaccess.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now