Solved

index.php automatic loading.

Posted on 2014-10-20
4
96 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 17

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

733 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