| 11:40 am on Aug 2, 2012 (gmt 0)|
With regard to the replacing .html with .php, you can keep the same extensions for your pages by using this command in an .htaccess file
AddType application/x-httpd-php .htm .html
This command instructs your web server to execute php code inside web pages with .html extensions.
Inside your .html web page you can then have code like this
which will be executed.
The nav.php file can contain html code for your nav menus.
Then for any future changes, you simply change nav.php once and all your page that include nav.php change as well.
There will be a slight slowing down of page load, but I think it would be negligible.
Google hopefully will be crawling your pages on a regular basis and will pick up on any additions to your navigation, regardless of whether you add them manually to each page or use the nav.php include.
Again using the hard-coded nav or nav.php include should not affect your rankings.
Hope that makes sense.
| 5:12 pm on Aug 11, 2012 (gmt 0)|
If what you wish to include is static,
you do not have to use php includes.
Simply use includes for the static text:
<!--#include file="footer.html" -->
KISS & HTH
| 9:11 am on Aug 13, 2012 (gmt 0)|
Sorry, I posted this question on several forums and I forgot about this one until I got the e-mail notification.
JohnNZ: Thanks very much for your reply. As I've heard, and as you've said: There will be a slight loading, but not too bad. However, even if it isn't too noticeable, my manager isn't too keen on the idea so I think I'll look into other ways.
Jonesy: Thanks for your reply. I attempted this, but it didn't seem to make any affect. However, I was only viewing it through notebook onto my browser. Would it only show an effect if I uploaded it onto my hosting server?
| 9:57 am on Aug 13, 2012 (gmt 0)|
Okay, so I put my question to the test and it never worked on the hosting server. However, once I changed the filename to .shtml it worked. This bothers me as it means I'll have to change all of my pages to .shtml and this will just confuse Google.
I suppose nothing is ever simple.
| 11:21 am on Aug 13, 2012 (gmt 0)|
All you need to get SSI to work on html files is something like
|AddHandler server-parsed .html |
or you could try
|AddOutputFilter INCLUDES html |
in your configuration
| 12:54 pm on Aug 13, 2012 (gmt 0)|
I tried out the SSI and it worked, however our page was very, very slow to load.
| 1:30 pm on Aug 13, 2012 (gmt 0)|
I use php includes in my pages for navigation and other things, like ads, headers and footers, etc.
I didn't notice any slowing of page loads when I implemented this, and, for all pages but the first downloaded, I imagine the loading should actually be faster, since the include is already in the browser cache.
You can search for 'css drop down menus' for lots of ways to do this simply.
All of my new pages are written as .php although they are in standard html.
I also wonder about a good way to change all of my old pages to .php, with minimum SE upset, but as yet have not investigated this too seriously.... since everything works with the .htaccess file's help!
| 2:09 pm on Aug 13, 2012 (gmt 0)|
|AddType application/x-httpd-php .htm .html |
This command instructs your web server to execute php code inside web pages with .html extensions
Does anyone have a clue on how this affects server load?
Thanks for any insights.
| 2:11 pm on Aug 13, 2012 (gmt 0)|
tbear: Thanks for your reply.
Huh, this is rather strange then. I wonder why it's loading slowly for us. In all honesty, the whole website needs revamped as when I first created it, we only had a few pages. Now that it's expanded, it's a bit of a mess.
I'm hesitant about using includes in case I do something wrong, but it will certainly make things easier.
| 4:27 pm on Aug 13, 2012 (gmt 0)|
Adding AddType application/x-httpd-php .htm .html to your htaccess file may or may not work, it depends on how your host's server is configured. The best way to get it right is to ask your host.
I went through the changes you describe several years ago for keeping navigation up to date. The .php includes will not show up on your desktop unless you are using a desktop server for your development.
Some things I learned from trial and error are:
1. make sure the character set and doctype for your includes matches the page they are included on. If you are using Windows the UTF-8 character set often uses "UTF-8 with BOM" that can leave a funny looking character in the page (it is a Byte-Order-Mark).
2. Clip out a block of text to use for your include that won't affect your page layout if for some reason it fails to process. Have more than one size (length) of page navigation to use as an include because you don't want people to view a page that is full of whitespace caused by a menu column that stretches the page length.
3. The best way I found to create your nav include is to use a page that you would like the other pages' navigation to resemble and simply cut out the text between the <container> tags whether div, td or p tags, paste it into a new text file and save it as nav.php or whatever you want your include to be called.
| 4:52 pm on Aug 13, 2012 (gmt 0)|
not2easy is quite right about asking your host to apply the .htaccss code. That is exactly what I did. Also regarding having a desktop server (I use xampp).
You can always create a test page, to put on your server, to try things out before using stuff site wide. That way you won't get any nasty surprises.
I have just implemented a multi-tiered drop down menu, just to keep the main menu size down to about 6 main categories, then using subs for each page. The two reasons are to contain the size and so as not to confuse visitors with too many choices.
| 8:51 am on Aug 14, 2012 (gmt 0)|
Thank you very much not2easy and tbear!
If I have any more problems (which knowing me, I will) I shall be back. ;)