简体   繁体   中英

php to html request without changing browser url

My site is working with .html extension in the URL. However i want to change it to .php. But pages are not working. Is there any way that url is using .php extension and server is treating it as .html request

Most likely you don't have Apache setup to parse PHP files. Unless I am missing what the question is? You want too rename the .html files to .php and still have them work?

By default in Ubuntu 12.04 PHP is enabled via the php5.conf file in mods-available that should look like this.

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
    SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    <IfModule mod_userdir.c>
        <Directory /home/*/public_html>
            php_admin_value engine Off
        </Directory>
    </IfModule>
</IfModule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM