Solved

Change/Set new Homepage

Posted on 2006-11-15
15
179 Views
Last Modified: 2010-03-04
Hi guys, elementary question here,
Can anyone tell me home to change/set a new homepage (Is index.htm, should be index.php) on an Apache server?  There are several sites on this webserver, I was unsure if my change is done by editing httpd.conf..
Cheers folks
0
Comment
Question by:slands10
  • 7
  • 7
15 Comments
 
LVL 16

Expert Comment

by:HackneyCab
ID: 17947729
Your question isn't clear.

Are you trying to tell Apache that a request for http://mydomain.com/ should serve http://mydomain.com/index.php or are you trying to do something else?
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 17947750
Generally this is done via the DirectoryIndex directive, like:

DirectoryIndex index.html index.htm index.php

would look first for index.html - if not found, it would then look for index.htm, and then for index.php.

This is most often done in the httpd.conf in your VirtualHost setup for your server, but you may be able to override this by putting this command in an .htaccess file, and placing it in the directory root of your web site.

0
 
LVL 15

Expert Comment

by:periwinkle
ID: 17947756
Re-reading -you want index.php to take precedence, so you'd use:

DirectoryIndex index.php
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:slands10
ID: 17948081
Sorry, I should clear things up,

the current directory is /var/www/website.co.uk which contains the current homepage - index.htm.
I am wanting to change the homepage to index.php, which is a file I am waiting for a user to ftp to the server.  From my understanding, I need to change a configuration file to point to index.php instead of index.htm.

periwinkle, I think I follow what you are saying.  Currently, the .htaccess file can be found in /var/www/website.co.uk/accesslogs/ and it contains 'deny from all'
I should move this to /var/www/website.co.uk/, and then edit it to contain the line you specify, adjusting it to suit my needs - DirectoryIndex index.php index.html index.htm

?

Thanks for your quick replies guys

:-)
0
 

Author Comment

by:slands10
ID: 17948286
HackneyCab, that is precisely what I am trying to do, thanks
0
 
LVL 15

Accepted Solution

by:
periwinkle earned 50 total points
ID: 17948514
RE: (periwinkle, I think I follow what you are saying.  Currently, the .htaccess file can be found in /var/www/website.co.uk/accesslogs/ and it contains 'deny from all'
I should move this to /var/www/website.co.uk/, and then edit it to contain the line you specify, adjusting it to suit my needs - DirectoryIndex index.php index.html index.htm)

No, no!  There can be several .htaccess files on your server, and there are many configuration options  This one was placed in the accesslogs directory so that the outside world cannot view that directory.  If you move that .htaccess file into your main directory, no one will be able to see your website.

Instead, try creating a new on in your /var/www/website.co.uk directory can put in:

DirectoryIndex index.php index.html index.htm
0
 

Author Comment

by:slands10
ID: 17948622
Cheers chief!  I follow you now.  I think they call this 'learning on the job'....

Thanks again man, you too HackneyCab, very quick responses!
0
 

Author Comment

by:slands10
ID: 17949135
Hi guys, I hope somebody sees this as I've more or less closed the topic!

When adding .htaccess to /var/www/website.co.uk, with DirectoryIndex index.php, the page is not picked up and I am taken to the CentOS/Apache test page.

Any ideas?

Thanks
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 17949501
If you place an .htaccess without ANY contents in that directory, does that happen?
0
 

Author Comment

by:slands10
ID: 17949541
It sure does.  index.php is not defined in DirectoryIndex in the httpd.conf file, which is strange as other sites onn the same server use index.php files, and they have no .htaccess file associated with them.  I'm totally stumped.  
Thanks for the input
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 17949581
Can you modify the httpd.conf file? Perhaps this is one of those directives that doesn't work properly from the .htaccess file.
0
 

Author Comment

by:slands10
ID: 17954265
Hi periwinkle, I tried both the .htaccess file and also editinf httpd.conf and adding index.php into the DIrectoryIndex section, neither worked.  I'll work on it more today and post if I find the answer, thanks for the help
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 17955932
I suspect that there is more at conflict, then.

Can you post your virtual host sections for this domain (feel free to disguise the actual domain and ip address)?
0
 

Author Comment

by:slands10
ID: 17956113
Alrighty!
Bit more of a smile on my face now.  The problem was that each website had a config file defined for it, located at etc/httpd/conf.d/website.co.uk.conf.
In this file there was a DirectoryIndex line with index.htm defined.  Changed this to index.php, which did not seem to do anything until I entered 'service httpd restart' command
and
voila!  Happy days, as they say.

Thanks for all your input peri, much appreciated, I now understand it all a little better.  Hope this helps someone else in the future too, good work.

Cheers again, chief
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 17956141
Ah!  Awesome - I'm glad your problem is solved!
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

831 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