Jump to content

html or php file extension


jimfog

Recommended Posts

Here is a question I always had and now is the opportunity to ask.

If someone wants to write PHP code, what is it better, using a php file extension or an html file extension and just put the

php code in there-in between the corresponding tags of course.

Link to comment
Share on other sites

i know is possible for php to directly parse in simple .html extensions, I just don't remember exactly how. I do remember certain frameworks, Zend specifically, created special new extensions like .phtml which php will run in, different from mod_rewrite which makes sure the browser doesn't show the ".php", ".html", or ".phtml".

 

I don't know exactly why they don't simply allow .html extension to directly run PHP by default, but my guess would be certain things like compatibility, overhead, etc.

Link to comment
Share on other sites

What if you have a website that you've been optimizing on search engines for years, with links all over the internet. Say, for example, a website that has a bunch of online tutorials that people link to. What if you decide that you want to change the underlying architecture of the site because you've found a more powerful and more efficient way to do everything? What if that architecture change includes a change in the server-side language that you're using? Are you going to change every single URL on your site so that all of your old search-engine-ranked URLs no longer point to the correct content? Are you going to mess around with redirecting the entire old site to the new site? How about just setting up the server so that it uses the new language to handle the old URLs?

 

That's just one example, of course. There could be any number of reasons for doing something like that. Maybe you want a language-independent URL, like Google uses, so that you can change your languages without changing your URLs. Maybe you want to use custom file extensions for whatever reason. Maybe you're Microsoft running outlook.com and you want .srf files to be handled by a specific application. Maybe you just want to hide the technologies that your server is using for security reasons.

 

There are an infinite number of reasons why someone might want to do something. Software developers typically don't seek out all of those reasons. Some are valid, maybe some are pointless. That's not a reason to not have a certain option in your application. If it is possible (and, actually, necessary) to define a set of extensions that various application mappings can handle, then why wouldn't a system administrator have the ability to add any extension to any application mapping? Why would the person developing the web server application prohibit the admin from doing that? Can you think of a single example why that ability should be artificially restricted when there's not a technical reason to restrict it?

Link to comment
Share on other sites

hi guyz..please i want to hide my .php extension but i couldn't can you please help me out

please start a thread for your question with what you have tried so far and what you're stuck on

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...