Solved

Change/Set new Homepage

Posted on 2006-11-15
15
178 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
 

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Apache server crashes randomly 38 109
Apache Issues 9 66
Setting up a WAMP server... 7 55
Missing Apache mod_DBD packages in Centos 7 2 66
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

13 Experts available now in Live!

Get 1:1 Help Now