Author |
Message |
Daniel
Team Member


Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Sep 22, 2002 6:01 pm (21 years ago) |
  |
Ever wanted to keep your files ending in .html (that's the way they were before, or you want to have them like that because it "looks better" )?
If so, here's a little tip. It only works with Apache, but most servers use Apache anyway
Put the following text in a file called ".htaccess" in the root of your site:
Quote: | <Files *.html>
ForceType application/x-httpd-php
</Files> |
That's it!
Your .html files should now be parsed by PHP.
To do the same with any other files, just replace with Quote: | <Files *.whateveryouwant> |
|
________________________________
 |
|
    |
 |
adam
Forum Moderator & Developer

Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Tue Sep 24, 2002 6:20 pm (21 years ago) |
  |
you could do this with less code, simply:
Code: |
AddType application/x-httpd-php html inc cuo
|
This would make *.html, *.inc and *.cuo be parsed through PHP. |
________________________________ It's turtles all the way down... |
|
     |
 |
Daniel
Team Member


Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Tue Sep 24, 2002 6:23 pm (21 years ago) |
  |
Yes, that's true. But my example can be more widely used, as you can use it for only one file:
Quote: | <Files blabla.html>
ForceType application/x-httpd-php
</Files> |
|
________________________________
 |
|
    |
 |
adam
Forum Moderator & Developer

Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Tue Sep 24, 2002 8:31 pm (21 years ago) |
  |
well, then it depends on your specific situation...
not sure why you'd need to use it on just one file though... |
________________________________ It's turtles all the way down... |
|
     |
 |
Daniel
Team Member


Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Wed Sep 25, 2002 5:31 am (21 years ago) |
  |
Well that's what we're having to do at 4WebHelp, because we have some files which have no extension  |
________________________________
 |
|
    |
 |
php4ever
Junior WebHelper


Joined: 10 Oct 2002
Posts: 49
|
Posted:
Fri Nov 08, 2002 6:31 am (20 years, 10 months ago) |
  |
I took Daniel's suggestion and put the Force Files directive in my .htaccess file so that all the html files at my site can contain php which will be parsed. But, tonight I noticed that I have one subdirectory that really needs to be exempt from this directive. So, how do I remove the <FORCE FILES> directive for just one subdirectory? I tried 'RemoveType application/x-httpd-php .html' and that didn't work. Any suggestions? |
|
|
    |
 |
Daniel
Team Member


Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Fri Nov 08, 2002 4:32 pm (20 years, 10 months ago) |
  |
Maybe Code: | AddType application/x-httpd-php php | would work?  |
________________________________
 |
|
    |
 |
php4ever
Junior WebHelper


Joined: 10 Oct 2002
Posts: 49
|
Posted:
Sat Nov 09, 2002 6:11 am (20 years, 10 months ago) |
  |
Thanks, Daniel, I tried what you wrote above but it didn't work. If you have any other thoughts, pls let me know.
--php4ever |
|
|
    |
 |
Daniel
Team Member


Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sat Nov 09, 2002 7:44 am (20 years, 10 months ago) |
  |
Not sure if this works, but try
It's worth a try  |
________________________________
 |
|
    |
 |
php4ever
Junior WebHelper


Joined: 10 Oct 2002
Posts: 49
|
Posted:
Sat Nov 09, 2002 11:48 pm (20 years, 10 months ago) |
  |
Daniel, tried your latest suggestion in re ForceType but that didn't work either.
Again, thanks for trying to help; I appreciate it. |
|
|
    |
 |
adam
Forum Moderator & Developer

Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Sun Nov 10, 2002 1:49 pm (20 years, 10 months ago) |
  |
if you used the force type thing for .html, try using just .htm for the files in that directory...I know it'll mean a lot of renaming and link changing...but it's all I can think of  |
________________________________ It's turtles all the way down... |
|
     |
 |
php4ever
Junior WebHelper


Joined: 10 Oct 2002
Posts: 49
|
Posted:
Mon Nov 11, 2002 7:25 pm (20 years, 10 months ago) |
  |
adam wrote: | if you used the force type thing for .html, try using just .htm for the files in that directory...I know it`ll mean a lot of renaming and link changing...but it`s all I can think of  | Adam,
Thanks for your suggestion. It does sound like a feasible solution -- and one that requires merely dropping one letter! However, as you note there is the tedium factor. There is also another way to resolve the problem that is also tedius -- replacing each '<?' in every file with <? Looks like the solution here will either way involve being less lazy than I'd like to be!  |
|
|
    |
 |
tarianz
Junior WebHelper


Joined: 10 Aug 2012
Posts: 1
|
Posted:
Fri Aug 10, 2012 5:01 pm (11 years, 1 month ago) |
  |
Thats works correct for me ))
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-bittorrent .torrent
bates methodглаукома |
|
|
     |
 |
runescapevip
Junior WebHelper

Joined: 16 Nov 2014
Posts: 3
|
Posted:
Sun Nov 16, 2014 7:58 am (8 years, 10 months ago) |
  |
FIFA online involved new material administrator technique is fairly Aspect within this version, as football lovers player from the FIFA sequence, the identical because the EA representative features of football administrator is certainly no stranger to be able to Fifa Coins enrich and enhance the encounter ways casual sex. |
|
|
    |
 |
|