Forum Moderators: coopster
Also, if the file is named index.php, is it still possible to only give people the www.example.com part without the /index.php, and the browser would show the website normally? I'm asking because I know that as long as the file after the slash / is called index.htm or index.html, then you don't have to include the index.htm part in the address, which makes whichever address you're giving look nicer and easier to remember. But when I tried going to a certain address without putting the index.PHP part, it didn't work. So, again, does the administrator of the website server or host have to do something to make this work with index.php files just as it works with index.htm files?
Are PHP files search-engine friendly? I know that a lot of the code inside a php file sometimes simply embeds X/HTML code into the page before sending it to the client, but generally speaking, are there any caveats, related to search engines, of which to be aware when all the pages in a website are PHP? For instance, is it a problem that the raw .php file does not have any "content", and it gets all the content from certain other .php or .htm files?
Finally, I heard of a certain method, which makes all the addresses within any website search-engine, bookmark, AND linking friendly, i.e., it gives you the ability to have a certain fixed URI for every item in your website, regardless of its file extension. And if someone had bookmarked a certain page in your site one year ago, but you changed the technology you use or something, then no one ends up with linkrot. What is this method exactly and where can I learn its implementation?
These questions have been answered a bunch. Go to Site Search [webmasterworld.com] and put in something like "php search engines" to look at past discussions.
I have to take my final question to a separate post now, though. But at least now there's only one question and very specific.
I have heard it does not like question marks in the URL, though personally I've not had a problem there. Nor does it like session IDs. But just the php extension is not a problem.
Is it a requirement to name any PHP file of a web page with the .php extension, in the form of index.php, for instance? Or can you name the file index.htm, even though it has <?php...?> code in it, and it would still work? I tested this index.htm file that has PHP code in it on my own computer, and it worked, or the page showed correctly. But when I uploaded the file to my website server, named with an .htm extension, it did not display correctly. Is there something wrong with the server, to which I have to draw the administrator's attention?
LOL. Only files with the extension '.php' are sent to the PHP parser. HTML files will not be parsed.
Also, if the file is named index.php, is it still possible to only give people the www.example.com part without the /index.php, and the browser would show the website normally?
Yes, so long as there isn't another page with the '.html' extension that would take precedence. Eg: if you have 'index.html' and also 'index.php', I'm guessing the first one is used first. But just use 'index.php' and you'll be fine.
Finally, I heard of a certain method, which makes all the addresses within any website search-engine, bookmark, AND linking friendly, i.e., it gives you the ability to have a certain fixed URI for every item in your website, regardless of its file extension. And if someone had bookmarked a certain page in your site one year ago, but you changed the technology you use or something, then no one ends up with linkrot. What is this method exactly and where can I learn its implementation?
[webmasterworld.com...]
Oh wait, you posted that one! Well I hope someone will have helped answer the question there...
To make it work on your server; change the following in your httpd.conf:
AddType application/x-httpd-php .php
to the following:
AddType application/x-httpd-php .php .htm .html
The major problem with this is that every .htm / .html file will be php parsed which could cause a performance problems.
Alternatively you can also use .htaccess to 'forward' all .htm files to a .php equivalent.
Although by the way, if you're not on Apache the above will not work properly, heh :)
On Apache it tends to be index.html > index.htm > index.php (IIRC), this can be changed although you'll have to google [google.com] for it. :).
Ie that is to say www.widgets.com is automatically going to pick up www.widgets.com/index.html/.htm/.php etc.
My old workplace's IIS used to default to default.asp then index.html (for some unknown reason)
Hope that helps.