mojito Posted March 29, 2006 Share Posted March 29, 2006 Using the code in a htaccess file one can specify that any file extension be treated as if it were a php file.I wonder why this is done, for me it makes a dependancy situation arise that if the htaccess is not there then the code is output to the browser and a security risk. Ok so we can be careful but is it a SEO thing?do .php pages get a worse treatment from spiders?what other considerations..here is the content of the .htaccess for complettness-would this replicate in child folders or does this file need to be in child folders too?[code]AddType application/x-httpd-php .htmlAddType application/x-httpd-php .htmAddType application/x-httpd-php .php3[/code] Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted March 29, 2006 Share Posted March 29, 2006 ratther then doing the following: [code]AddType application/x-httpd-php .htmlAddType application/x-httpd-php .htmAddType application/x-httpd-php .php3[/code]in you .htaccess do it one line like so:[code]AddType application/x-httpd-php .html .htm .php3 .phtml[/code]just seperate each file extension by a space!You dont have to put .htaccess file in every folder. However you can just place it one folder and it'll effect everysingle folder that is below it. Such as the root folder (wwwroot, public_html, public_www or whatever your root folder is called). Quote Link to comment Share on other sites More sharing options...
ober Posted March 29, 2006 Share Posted March 29, 2006 Keep in mind that some people are forced to do this if they don't have access to the web server configuration files. Quote Link to comment Share on other sites More sharing options...
TecBrat Posted July 16, 2006 Share Posted July 16, 2006 [quote author=mojito link=topic=89632.msg359675#msg359675 date=1143645237]Using the code in a htaccess file one can specify that any file extension be treated as if it were a php file.I wonder why this is done... [/quote]Thanks for the info, and I'll give my answer to your wonder. We will occasionally take over a website that has already established itself with html files. If I go changing them to php files, who knows what references might get messed up (Internally, or from 3rd party links)? Now I will be able to customize those pages with my code, but not re-name them.TecBrat.[code]AddType application/x-httpd-php .html .htm .php3 .phtml[/code] This worked for me.pardon a bit of keyword stuffing, but people might need help finding this thread:parse php inside html, read php in html files, treat html like php. extensions Quote Link to comment Share on other sites More sharing options...
snailface Posted July 26, 2006 Share Posted July 26, 2006 Does anyone know of a situation where modifying the htaccess file (or adding one to a specific directory within a hosting account) would cause the following behavior?I added an htaccess file consiting only of the line to a directroy where I would like .html files to be parsed for PHP:[b]AddType application/x-httpd-php .html .htm .php3 .phtml[/b]But now, when I navigate to that directory (without specifying a file so that it should default to index) I get prompted to open or save a file.If I navigate specifically to the file, it is displayed in the browser, but without the PHP having been parsed.To see what I am talking about I put up some sample files.To see the wierd file download behavior go to:http://www.littlegreentoaster.com/testdir/To see the HTML file without the PHP parsed:http://www.littlegreentoaster.com/testdir/index.htmlAnd to validate that PHP is installed and workinghttp://www.littlegreentoaster.com/testdir/index2.phpThanks in advance to anyone who can shed some light on this for me.-adam Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.