• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Change index.html to index.php

AStorch

New Pleskian
Hi

I am trying to find the place where you can choose which preference for the landing page ie index.html or index.htm or index.php I can not find it anywhere in Plesk 10
 
For me its in the following two files (Centos) :

[root@vz1038 conf.d]# grep -i directoryindex /etc/httpd/conf/httpd.conf
# DirectoryIndex: sets the file that Apache will serve if a directory
DirectoryIndex index.html index.html.var index.shtml index.cfm index.php index.htm
[root@vz1038 conf.d]#

[root@vz1038 conf.d]# grep -i -B 4 directoryindex /etc/httpd/conf.d/php.conf
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

The php.conf file is read after hence it takes priority (it seems),

Paul.
 
Hi Paul

Thanks for the input. However, My Network admin insists:


Plesk does not like it when you go changing the httpd.conf file manually. Usually, there is
some other way of doing it.
 
Are you an admin of the server / have admin access to Plesk?

You could do one of the following :

1) Add a .htaccess with your preferred DirectoryIndex to the virtual host template
2) Add an event handler on domain creation to insert a vhost.conf and vhost_ssl.conf with the DirectoryIndex values you want
3) Edit the Plesk httpd.include templates (no idea how to do that, don't really run Plesk 10 servers)
4) Add a zzdirectoryindex.conf to /etc/httpd/conf.d/ with your preferred order of DirectoryIndex (the point of the zz is to make sure its processed after both the httpd.conf and the php.conf file).

All of these should work without Plesk getting too far in the way ;)

Paul.
 
Hi Paul

No I am not. But I have been consulting with our Network Admin and he says:

That's how we did it on older versions of Plesk. I would think there would be a better way of
doing it now.
 
I have a similar problem:
I need to write an Event to redirect from MyDomain.com to MyDomain.com/index.php. What should be the Event?

Thanks, UL
 
Hi Paul

From my admin:

Option #1 adding the .htaccess file :

I have created a vhost.conf within /var/www/vhosts/domain.com/conf with the following content.

<Directory /var/www/vhosts/domain.com/httpdocs>
<IfModule mod_php4.c>
php_admin_flag safe_mode off
</IfModule>
<IfModule mod_php5.c>
php_admin_flag safe_mode off
</IfModule>
</Directory>


I also created a .htaccess file within directory '/var/www/vhosts/domain.com/httpdocs'
with the following content

DirectoryIndex index.php


After issuing the command ' /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain domain.com '

Is this the correct way of doing this? Is there any way to verify within a httpd.include file that I read about?
 
Hi,

Now I'm somewhat confused, the default behaviour in Plesk with PHP enabled is for domain.com/index.php to be loaded when you go to domain.com/ . I assumed you wanted to change it to something else.

Are you getting different behaviour?

Also the .htaccess should be fine, and the vhost.conf isn't relevant for what we're doing,

Paul.
 
I would beg to differ with your network admin.

Modifying /etc/httpd/conf/httpd.conf is perfectly safe as long as you don't fiddle with things you shouldn't. Plesk does not modify this file anymore, and will not overwrite any changes you make. I think it used to many years ago, but no longer.

Changing the DirectoryIndex line is perfectly safe and the way to do it.

The order the index files appear in the list is the order that they will be looked up.
 
Hi Guys

We were able to fix the issue.

1. Changed the default index to index.php within the vhost.conf

2. Changed customers absolute paths within their coding to './' path so whenever they move, they don't have to go in and change code manually



Thanks for all your input. it is much appreciated!
 
Where does one find the vhost.conf file? Via FTP or in the Plesk control panel? I'm having the same issue wherein I can not get a wordpress installation to "trump" the plesk index page despite proper installation via ftp, plesk subscription/database/user creation, etc. Thanks!

My .htaccess file reads:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Note: In Filezilla, I can not change the permissions of the var folder to 777 or anything else to create any new directories or add any files.

Note: In Filezilla, my conf file has a ? next to it and clicking on it I receive "Failed to retrieve directory listing". I can not modify this file in any way.
 
Last edited by a moderator:
Where does one find the vhost.conf file? Via FTP or in the Plesk control panel?

By default vhost.conf is absent for new domains. If you want to customise something you should create vhost.conf file in directory with your domain (/var/www/vhosts/test.tld/conf/) and run websrvmng (/usr/local/psa/admin/bin/websrvmng).
Line with including of your custom config will be automatically added to httpd config:

# grep "vhost.conf" /var/www/vhosts/test.tld/conf/* |grep -v "#"
/var/www/vhosts/test.tld/conf/13226735700.58056000_httpd.include: Include "/var/www/vhosts/test.tld/conf/vhost.conf*"
#
 
Howdy Kriogen, and thanks for trying to answer the question.

I can not modify the /var file or add any pages or directories to it.

Also, I did not run across this issue with 5 identical installations this morning, so I'm wondering, what's different about this one? I haven't had to make all these changes suggested in this forum to delete the plesk index page (yes, I renamed it... no affect) on any other site. Thougths? Frustrated! Thank you :)
 
705

FYI ~ Changing the permission of index.php to 705 solved my plesk index page problem.
 
Back
Top