Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Change/Set new Homepage

Posted on 2006-11-15
15
Medium Priority
?
185 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
[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
  • 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 200 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

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 …
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month8 days, 9 hours left to enroll

597 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