BLiu1's Blog

All Pages PHP

January 12, 2014

Today, I'm going to reveal a big secret (that I mentioned in my first post). All of my website runs on PHP. I am going to show how you can do this too.

Before we get started, you need an Apache web server and access to a file called ".htaccess" (no the dot is not a typo).

.htaccess files affect the directory they are placed in and all sub-directories.

Some sites do not allow use of .htaccess files, since depending on what they are doing, they can slow down a server overloaded with domains if they are all using .htaccess files. I can't stress this enough: You need to make sure you are allowed to use .htaccess before you actually use it. Some things that .htaccess can do can compromise a server configuration that has been specifically setup by the admin, so don't get in trouble.

Read more about .htaccess here: http://www.javascriptkit.com/howto/htaccess.shtml

OK. Once you have a(n) ".htaccess" file on your server, you should keep anything that is there and type RewriteBase / at the top if it's not there. The following two lines will tell the server to parse HTMLs as PHP!

RemoveHandler .html .htm
AddType application/x-httpd-php .php .html

I hope this helps all who use JavaScript includes and want a PHP solution. ;)

Tags:

Comments

BLiu1's Blog - All Pages PHP

comments powered by Disqus
eXTReMe Tracker