Solved

Change/Set new Homepage

Posted on 2006-11-15
15
177 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
Comment Utility
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
Comment Utility
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
Comment Utility
Re-reading -you want index.php to take precedence, so you'd use:

DirectoryIndex index.php
0
 

Author Comment

by:slands10
Comment Utility
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
Comment Utility
HackneyCab, that is precisely what I am trying to do, thanks
0
 
LVL 15

Accepted Solution

by:
periwinkle earned 50 total points
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:slands10
Comment Utility
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
Comment Utility
If you place an .htaccess without ANY contents in that directory, does that happen?
0
 

Author Comment

by:slands10
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Ah!  Awesome - I'm glad your problem is solved!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

9 Experts available now in Live!

Get 1:1 Help Now