Rename files tricks

Here we have two tricks which can save you from renaming all files and/or changing links in your navigation menus. You don't need to apply both tricks, one is enough.

Force PHP in .html pages

To force web server to process PHP code in .html files, you just need to create blank text file, name it .htaccess and place it in your web server's root folder (usually named htdocs/ or public_html/) and place following lines in it. If such file already exists, just append following code at the end of it:

AddType application/x-httpd-php .html .php .htm
:!: Note
This trick saves you both from renaming files and changing links in your website navigation. In other words, if you do this you will make Instant Update available in both .html and .php pages.

Keep links

To force old links to point to new files (e.g. you have contactus.php file but you want link to contactus.html to actually open contactus.php), create blank text file, name it .htaccess and place it in your web server's root folder (usually named htdocs/ or public_html/) and place following lines in it. If such file already exists, just append following code at the end of it:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*).htm[l]?$ $1.php [L]
</IfModule>
:!: Notes
This trick saves you from changing links in your website navigation. Still you need to rename all files and change their extensions from .html to .php, but you don't have to change website navigation links.
You can't use this trick if you are using automatic menus with SEO links, and really there is no need to use it in that case.
 
install/tricks.txt · Last modified: 2008/09/11 02:57 by avram
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki