473,372 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

How to use .htaccess to parse only .html files as .php?

Els

***newbie question***

Hi, I am trying to make my server (Apache) parse .html files
as .php.

I found this line of code:
ForceType application/x-httpd-php
placed it in an .htaccess file and uploaded it to the
directory I wanted it to work.
And it worked; my .html files are all parsed as .php.
But, apparently, so are my images, so they aren't loaded
into the pages. And something else, my css file isn't found
anymore by Netscape and Mozilla, while IE has no problem...
I'm calling my css file with @import url(all.css); in the
<style> block in the head of my .html files.

How do I make the server parse _only_ .html files as .php,
and why don't Mozilla and Netscape find the css file? (They
did before I sent the .htaccess file)

Sincerely,

--
Els

Mente humana é como pára-quedas; funciona melhor aberta.
Jul 16 '05 #1
6 5161
On Sun, 31 Aug 2003 19:24:14 +0200, Els <el*********@PLEASEtiscali.nl.invalid>
wrote:

***newbie question***

Hi, I am trying to make my server (Apache) parse .html files
as .php.

I found this line of code:
ForceType application/x-httpd-php
placed it in an .htaccess file and uploaded it to the
directory I wanted it to work.
And it worked; my .html files are all parsed as .php.
But, apparently, so are my images, so they aren't loaded
into the pages. And something else, my css file isn't found
anymore by Netscape and Mozilla, while IE has no problem...
I'm calling my css file with @import url(all.css); in the
<style> block in the head of my .html files.

How do I make the server parse _only_ .html files as .php,
and why don't Mozilla and Netscape find the css file? (They
did before I sent the .htaccess file)


Either

<Files *.html>
ForceType application/x-httpd-php
</Files>
Or just

AddType application/x-httpd-php .html

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 16 '05 #2
On Sun, 31 Aug 2003 19:24:14 +0200 in
<message-id:bi**********@reader1.tiscali.nl>
Els <el*********@PLEASEtiscali.nl.invalid> wrote:

***newbie question***

Hi, I am trying to make my server (Apache) parse .html files
as .php.

I found this line of code:
ForceType application/x-httpd-php
placed it in an .htaccess file and uploaded it to the
directory I wanted it to work.
And it worked; my .html files are all parsed as .php.
But, apparently, so are my images, so they aren't loaded
into the pages.

Is '.html' deliberately missing there?
ForceType application/x-httpd-php .html
I suspect that without, it's forcing _everything_ to be parsed as PHP.

And something else, my css file isn't found
anymore by Netscape and Mozilla, while IE has no problem...
I'm calling my css file with @import url(all.css); in the
<style> block in the head of my .html files.

How do I make the server parse _only_ .html files as .php,
and why don't Mozilla and Netscape find the css file? (They
did before I sent the .htaccess file)

Sincerely,

AFAIK, @import() is for IE only.. use HTML:
<link rel="stylesheet" href="/css/foo.css" type="text/css" />
etc etc.
HTH =)

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Jul 16 '05 #3
On Sun, 31 Aug 2003 18:30:16 GMT, "Ian.H [dS]" <ia*@WINDOZEdigiserv.net> wrote:
AFAIK, @import() is for IE only.. use HTML:


@import is standard CSS1, not IE specific.

http://www.w3.org/TR/REC-CSS1#the-cascade

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 16 '05 #4
Els
Andy Hassall wrote:
On Sun, 31 Aug 2003 19:24:14 +0200, Els <el*********@PLEASEtiscali.nl.invalid>
wrote:

How do I make the server parse _only_ .html files as .php,
and why don't Mozilla and Netscape find the css file? (They
did before I sent the .htaccess file)

Either

<Files *.html>
ForceType application/x-httpd-php
</Files>
Or just

AddType application/x-httpd-php .html


It works, thanks!
Can you recommend me any website where stuff like this is
explained in beginner mode? (just for future reference ;-) )
--
Els

Mente humana é como pára-quedas; funciona melhor aberta.

Jul 16 '05 #5
Els
Andy Hassall wrote:
"Ian.H [dS]" wrote:
AFAIK, @import() is for IE only.. use HTML:


@import is standard CSS1, not IE specific.

http://www.w3.org/TR/REC-CSS1#the-cascade


I used @import, so that all browsers could find the file,
except the older ones, like NN4, who would render it
completely wrong. They don't see @import, so in there, I put
all the CSS for newer browsers. Then, I'll make a <link
rel="stylesheet" href="/css/foo.css" type="text/css" />
which will be found by NN4, but overruled by @import for the
newer browsers. (if I make sure the @import is lower in the
<head> than the <link>..)

--
Els

Mente humana é como pára-quedas; funciona melhor aberta.

Jul 16 '05 #6
On Mon, 01 Sep 2003 23:19:41 +0200 in
<message-id:bj**********@reader1.tiscali.nl>
Els <el*********@PLEASEtiscali.nl.invalid> wrote:
Andy Hassall wrote:
"Ian.H [dS]" wrote:
AFAIK, @import() is for IE only.. use HTML:


@import is standard CSS1, not IE specific.

http://www.w3.org/TR/REC-CSS1#the-cascade


I used @import, so that all browsers could find the file,
except the older ones, like NN4, who would render it
completely wrong. They don't see @import, so in there, I put
all the CSS for newer browsers. Then, I'll make a <link
rel="stylesheet" href="/css/foo.css" type="text/css" />
which will be found by NN4, but overruled by @import for the
newer browsers. (if I make sure the @import is lower in the
<head> than the <link>..)

Ahh that makes sense, and clarifies my confusion.

I was confusing (myself with) "@import() is for IE only" and "older
browsers < IE4 && NN4 etc".

I knew there was a reason and a difference in the "HTML method" and the
@import() method.. I guess I should type what I mean in future.. and
more regular coffee =)

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Jul 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Nel | last post by:
Just looking for some general advice on modifying the URL for php. I am using .htaccess to allow a web site to translate example.html to index.php?content=example (below) ErrorDocument 404...
3
by: Adam King | last post by:
Hey, I've done the standard old trick of adding the error page line into ..htaccess which works absolutely fine if I accidently go to any file other than .php But if I go to "doesntexist.php" I...
15
by: Taki Jeden | last post by:
Hello everybody Does anybody know why w3c validator can not get pages that use 404 htaccess redirection? I set up two web sites so that clients request non-existent urls, but htaccess redirects...
0
by: Jack Hambabo | last post by:
Hi, I'm searching for a php script that can find out whether the current user (I know _SERVER will give me the name for non-cgi php) has the right to view a specific file. My dream is that I...
4
by: Stefan Bellon | last post by:
Hi all! I want to parse the contents of an .htaccess file from within PHP. The contents of the .htaccess file looks like this: <Files foobar.tar.gz> AuthType Basic AuthUserFile /foobar...
1
by: nickyeng | last post by:
I have checked this info from apache website, and i confused with it. Procteing System files it said: To run a really tight ship, you'll want to stop users from setting up .htaccess files...
2
by: jaanus | last post by:
Here we go... What I have been trying to do is to forward all http requests containing /cms/ to http://cms.mydomain.com/ example1: http://host1.mydomain.com/cms/init.php would be parsed from...
2
helimeef
by: helimeef | last post by:
Hi. I'm having issues trying to get .htaccess make mod_rewrite work. I have mod_rewrite setup properly (it's in phpinfo()), but it just seems to not work. Right now I have two files, bob.html and...
8
by: Geoff Cox | last post by:
Hello, Using .htaccess and a linux server is it possible to give group access to a person so that he/she can access files in several different folders? If yes, how is this done?! Cheers
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.