News:

Click here for Toll-Free Service for your business starting at $2.00 per month

Main Menu

.htacess Question -Reading .tpl as .php

Started by sixthcrusifix, January 09, 2006, 12:19:43 PM

Previous topic - Next topic

sixthcrusifix

somone gave me this before but I lost it. I need to have a .htaccess file that will make a file with the extension .tpl read as a PHP file because setting PHP to execute on all extentions isn't working for .tpl but the .htaccess will.

Visite me website at http://www.sixthcrusifix.com

GP™

Add this to .htaccess

AddType application/x-httpd-php .tpl

sixthcrusifix

Quote from: gordon on January 09, 2006, 06:19:29 PM
Add this to .htaccess

AddType application/x-httpd-php .tpl

thank you :D

Can I just put that in the ROOT Directory or do I have to put that in the drectory that the .tpl Files are in??
Also: I can just put that right? I don't have to put rewrite rule one or anything do I ? I'll try it out and see maybe I'll answer my own questions.
Visite me website at http://www.sixthcrusifix.com

Ben

You can put it in any directory if you want, that's where I keep almost all of my .htaccess commands.
And that line as it is should work fine, just keep it on it's own line and make sure the rest of your file is valid

(And this is my first post in awhile.. yay!)
--Ben
Ben@freepgs.com

GP™

Yes, you can place in in your root dir, and yes, all thats required to phase your TPL files to php is that one line.
Keep in mind all .TPL files will be phased for php, even if there just html..

L8r,
Gordon

PSST. Congrads nq2h on your post ;)

webzone (archived)

Indeed, as both gordon and nq2h said, the rule will apply and the directory where you put the .htaccess is not important.

I'd just like to make it even clearer (it hasn't been said yet) :

All commands you place in .htaccess will apply to all the files in the same directory as .htaccess and all subdirectories. This statement is valid for all commands and rewrite rules. So if you put .htaccess in /a, all its rules will apply to /a, /a/b, /a/b/c and so on.

sixthcrusifix

Quote from: webzone on January 11, 2006, 02:26:14 AM
Indeed, as both gordon and nq2h said, the rule will apply and the directory where you put the .htaccess is not important.

I'd just like to make it even clearer (it hasn't been said yet) :

All commands you place in .htaccess will apply to all the files in the same directory as .htaccess and all subdirectories. This statement is valid for all commands and rewrite rules. So if you put .htaccess in /a, all its rules will apply to /a, /a/b, /a/b/c and so on.

so if I ONLY want it to apply to a sincle directory in root I'd put another .htaccess file in THAT directory?

Also if I have a .htaccess file in root/MAIN and one in root, will teh one in root still effect teh one in root/MAIN too?
Visite me website at http://www.sixthcrusifix.com

GP™

If you place the .htaccess file in your root directory it will effect the entire sub folders.
if you place it in /root/example then it will effect only example and the sub folders under it.

So if you palce your htaccess file in your root you will be able to use tpl files in any folder on your site..