sin Posted December 11, 2007 Share Posted December 11, 2007 I have several hudred .php files on my website, <b>all of them static</b>, and the only thing I want to do is request .../page in my browser and get the server to serve .../page.php (with the URL on the browser being .../page). I was given a .htaccess file on this forum to do the above (actually I couldn't get it to work, perhaps because I'm a total n00bie ) but after searching, it seems that I can simply upload my files without extensions and problem solved! Here's the question to all the experts out there: Use a .htaccess file to hide my .php extensions or simply upload my .php files without extensions? Some people also claim that there's a performance penalty when a .htacess file is used... could this be true in my case?? Thanks, Sin Quote Link to comment Share on other sites More sharing options...
madmax Posted January 8, 2008 Share Posted January 8, 2008 Would depend on a few things. Does your site consist entirely of HTML content which is ONLY in PHP files? You could remap the PHP filetype using AddType but mapping every file as "type PHP" might really not be too advisable unless you wanted a fairly steep performance hit Even though you might map a specified filetype such as PHP or PHP3 to the PHP processor the file still requires PHP tags <? ?> before (or <?php ?> it is interpreted by the processor so in theory that *could* work but not ideal. You might also need to give consideration to how the URL sources are going to originate in all that existing HTML code. i.e. can you afford to go through and edit them all as this is often one of the primary limitations when considering such as scheme. i.e. if all existing URLs point to *.PHP pages then that might merit a different solution. If you say you want to request "/page" then I'd guess you don't yet have the links or cross-links created Also, yes, using .htaccess files would add a small performance penalty on top of all of this. Generally not recommended if you have access to the main server config file. People tend to use these when on hosted accounts. You might need to ruminate on these issues first before thinking of coding a solution or asking someone else to spend time coding one up! 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.