473,386 Members | 1,860 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,386 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 5163
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.