Search code examples
phpmysql.htaccesswebcentos-web-panel

.htaccess multiviews not workinng in Control Web Panel server


I had a running php web application previously hosted using cpanel. Now I have shifted it to Control Web panel(CWP) for hosting . But the multiviews and error handling I managed using .htaccess file is not being responded by the server so that I need to add .php behind every links now. Is there any solution for it? My .htaccess file:

    Options +MultiViews
    DefaultType application/x-httpd-php

    Options -Indexes
    ErrorDocument 403 /403
    ErrorDocument 404 /404

Thank you in advanced.


Solution

  • You should definitely read the docs at httpd.apache.org and not rely on control panels or try and error.

    DefaultType was a fallback directive, is deprecated and has been disabled. It was never meant to activate interpreters.

    You are looking for SetHandler:

    SetHandler application/x-httpd-php
    

    This should activate PHP processing for every file on the server, as long as mod_php is loaded, including images, downloads and everything else.

    Maybe you want to use something like this instead:

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

    It will restrict PHP to those extensions only.

    Everything on MultiViews is a part of Content Negotiation.