Jump to content

.htacess files Vs files without extensions...


Recommended Posts

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 ;D) 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

 

 

 

 

  • 4 weeks later...

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! ;)

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.