php ForceType to "mask" php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jts
Forum Newbie
Posts: 1
Joined: Tue Oct 07, 2003 8:46 pm

php ForceType to "mask" php

Post by jts »

Maybe not #exactly# php-related, but maybe somebody out there has tried the same under FreeBSD (it seems to work flawlessly under other OSes:

I would like to make the server handle .htm files as if they were .php, for search-engine reasons. There are several methods for this, but under FreeBSD none of them seems to work.

httpd.conf:
<VirtualHost 199.239.248.88:80>
SSLDisable
ServerName woodlandsphuket.com
ServerAdmin info@woodlandsphuket.com
DocumentRoot /home/woodland/www/woodlandsphuket.com
ScriptAlias /cgi-bin/ /home/woodland/www/cgi-bin/
User woodland
Group woodland
ServerAlias http://www.woodlandsphuket.com
<Directory /home/woodland/www/cgi-bin>
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
<Location /force>
ForceType application/x-httpd-php
</Location>
</VirtualHost>

I tried as well in .htaccess:
<FilesMatch (*.htm|*)>
ForceType application/x-httpd-php
</FilesMatch>


Any help with this problem would be #very# appreciated!

Thanks, jts
phpmaven
Forum Newbie
Posts: 2
Joined: Tue Oct 07, 2003 11:51 pm

Post by phpmaven »

All you need to do is the following line above your Virtual Host declarations:

AddType application/x-httpd-php .php .htm

That's it!
Post Reply