Solved

index.php automatic loading.

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

717 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