Forum Moderators: coopster

Message Too Old, No Replies

Making php files look like htm files

         

nevetS

11:20 am on Jan 6, 2004 (gmt 0)

10+ Year Member



I thought I'd share this tidbit I just figured out. Since I'll be asking lots of questions, I should probably contribute what I can :)

In your apache.conf file:
<Directory /your/root/directory>
AllowOverride All
</Directory>

AllowOverride All allows .htaccess files to have control of your directories for password protection and a slew of other things. Google Apache AllowOverride for a complete understanding.

Now you need a .htaccess file in your root directory. It should look like this:

<FilesMatch "\.htm$">
ForceType application/x-httpd-php
</FilesMatch>

That's all there is to it. Now all of your .htm files will work as if they were php files. There is a problem, I understand, if you are using XML documents, but I'm not, so no problem for me :).

For those who may be in the dark, there is some debate as to whether or not dynamic pages (i.e. those with php extensions) are ranked lower than static pages (i.e. those with .htm extensions).

Since this is a relatively easy change, and I'm currently dealing with under 20 pages, I figure why take a chance?

I'm not quite sure how google deals with those pages that still require url parameters - i.e. message board pages - but that's also not a big concern for me right now.

Zygoot

10:11 pm on Jan 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Turning php pages into 'static html' pages will most likely improve the chance that a search engine indexes most of your pages.

Just take a look at the URLs of this board

It's using URLs like [webmasterworld.com...]
[webmasterworld.com...]
[webmasterworld.com...]