URL label?

Given my new understanding of the power of "includes" with PHP, I believe ALL of my pages on my site will be a .php extension.

Would it be considered strange?

I used to think that most pages would be .htm or .html, but as I browse the net, I notice that there really isn't any "standard".

I really don't think I have a choice if I want to call my menu from a php file. It will be exactly as far as I can see ... so just bouncing off of you all to see how "real programmers" feel about such problems.

+1


source to share


6 answers


What really matters to the browser is not the file extension; this is the MIME type it sends in the HTTP headers. Headers are data that is sent in front of the actual file and tells what data it represents, how large it is, and a bunch of other irrelevant junk. You can configure the server to send any file extension as an HTML page, but the most common extensions for HTML pages are .htm, .html, .php, .asp, .aspx, .shtml, .jsp, and a few others.



Because it looks "weird", a surprisingly small number of users will actually view the address bar at all, let alone the file extension being .php instead of .html. I wouldn't worry about it if I were you; it really doesn't matter.

+5


source


in general - make sure your URLs are easy to read, reflect the content underneath, and don't change. The "non-changing" part can be tricky, especially when you change technologies over time (html> php> aspx).

to achieve this, just make sure each area of ​​your site is in its own subdirectory.

mysite.com/news/

mysite.com/aboutus/



mysite.com/products/

and etc.

you can do this by physically structuring your site this way and using the default documents (default.html / php / aspx) or using something like text rewrite, ISAPI rewrite, or similarly rewrite those paths into appropriate documents.

someone who is into SEO or marketing may have a different idea of ​​what constitutes a "good" URL, but as a developer this is how I see it.

+4


source


Php URL completion is very technical, but I think a lot of people these days are trying to make URLs independent of the actual code / file structure.

I really think this is good in terms of software development. URLs are conceptually different (read: not linked at all) to the file / directory structure used to organize the system that manages the website.

The "resource" that the URL "finds" is not the .php or .asp file that contains the code to display it.

Look on stackoverflow for example the url of this question /questions/322944/uql-etiquette

, there is nothing in it that can be used to "guess" the underlying structure / system. The resource in this case is the question and all the answers to it, as well as comments, voices, changes and other materials.

+3


source


It doesn't matter what your urls end up with, .php

ok and pretty common. The only thing people care about these days when it comes to URLs is making them attractive for search engine optimization, but that's a whole new question.

+1


source


Real programmers use urls like / noun / verb / id / and don't display file extensions at all: p

Personally, I use Apache's mod-rewrite.

(on a slightly less laconic note). It should be mentioned, in particular, that you must ensure that your actual files have a .php extension. I have seen more than one site where the programming logic can be viewed in a browser because the developer has finished their .inc files (or is adding a manual extension breakdown here).

+1


source


As for etiquette - I really don't think etiquette is involved; however, if you have complex users visiting your site who have strong views on platforms and technologies, using the .php or .aspx extensions can put users off - perhaps subconsciously.

If you are using apache it is easy enough to make .php count as .py and vice versa by modifying the httpd.conf file. My current practice is to use .html extensions (or no extensions at all) and treat all files as .php.

Whatever you decide, make sure you never break an existing URL. This can be achieved even if you save the .php as an extension and later decide to change the technology.

0


source







All Articles