简体   繁体   中英

How Do I change extension of php file

I want to change the extension of php file.For example the file home.php is called in browser it should be shows like home.html. I can done it in codeigniter by using suffix variable in config file.But how can i achieve it in core php? I think it can be done through .htaccess file or may be from other way but how to do?please let me know.

i try:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.html

by using above code i try to but it is was not changed? or if there any other way to do it please let me know.

Use this rule :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.html$ $1.php [L]

It will redirect any request to a html file (that does not exists phisicaly) to a php file.

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