Change File Types with .htaccess
Most people are familiar with filetypes such as .JPG (photos), .XLS (Microsoft Excel), .DOC (Microsoft Word). That three letter ending ending tells the server how to read the file.
You can actually change how the server sees your files. You just add this little snippet of code to the .htaccess file and that's it. Your .html file can now be read as a .php file. You can even end your file name with something like .myfriendbob. Yes, you can make the file contact.myfriendbob act the exact same as a file named contact.shtml
The .htaccess file is found in the root directory of your website (http://mywebsite.com/.htaccess). If you can't find it, just create a new one. Open a text file and save it as .htaccess -- Not .htaccess.txt or anything like that.
Example 1:
Breakdown:
- shtml
- File type to be immitated.
- .html
- File type you wish to warp.
Translation: Any file with the extension .html will be treated as .shtml.
Example 1:
Breakdown:
- html
- File type to be immitated.
- .myfriendbob
- File type you wish to warp.
Translation: Any file with the extension .myfriendbob will be treated as .html.
