1

I am hosting in a whm/cpanel server and two of my sites were having .htaccess files that would parse .html files to .php.

However, the server is upgraded to Apache 2.4 and PHP to 5.5.38.

Since then the .htaccess files are not parsing the .html as PHP. I contacted the server provider, they said that the syntax for 2.4 is different which they don't know.

I'm a novice. If someone please help me with the correct .htaccess codes and if there is any module to be installed or scripts to be added in the root level, please provide me the step by step guidance - as I will just forward those instructions to the server provider.

Thanks in advance...

3 Answers 3

1

I'm not aware of any changes to the AddType or AddHandler directives between 2.2 and 2.4 - it could be the case that your htaccess file simply isn't running (disabled via AllowOverride, etc), or that it contains some other directive that isn't compatible with the new versions.

The required directive should be something like:

AddType application/x-httpd-php .html .htm

or

AddHandler application/x-httpd-php .html .htm

depending on the configuration.

Sign up to request clarification or add additional context in comments.

2 Comments

It doesn't work. I tried with both AddHandler and AddType. I think, some modules to be installed or some lines to be written in httpd.conf file - as I read at other sources. Is there any connection with PHP being CGI or not? Where is AllowOverride is enabled or disabled? Thanks.
The AllowOverride is ususally in the conf file for the site. If you can do something like this it should allow the htaccess be read. The conf file in Ubuntu is usually in /etc/apache2/sites-available. <Directory /var/www/> Options FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all </Directory>
0

Assuming AllowOveride is such that SetHandler is allowed.. per http://httpd.apache.org/docs/current/mod/core.html#sethandler .htaccess should look like...

 <FilesMatch "\.html$">
  SetHandler application/x-httpd-php
</FilesMatch>

Check /etc/apache2/apache2.conf and /etc/apache2/conf.d where AllowOverride is typically set. Check out http://httpd.apache.org/docs/current/mod/core.html#allowoverride for the syntax and list of allowable methods.

2 Comments

Received this response: On our server this has been set "AllowOverride All Options ExecCGI FollowSymLinks IncludesNOEXEC Indexes SymLinksIfOwnerMatch" Is it okay? Or, anything else to be done? I have made those changes with the .htaccess file at public_html but, it still ignores.
Not sure of that syntax.. "All" , but then a few others allowed which seems odd, but still apparently "SetHandler" is not allowed. :(
0

The new syntax is:

AddHandler "proxy:unix:/usr/local/php56/sockets/[username].sock|fcgi://localhost" .html .htm .inc

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.