?
Solved

index.php automatic loading.

Posted on 2014-10-20
4
Medium Priority
?
100 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 11

Accepted Solution

by:
John Easton earned 668 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 668 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 664 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

801 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