Solved

Change/Set new Homepage

Posted on 2006-11-15
15
180 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

791 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