473,796 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5184
On Sun, 31 Aug 2003 19:24:14 +0200, Els <el*********@PL EASEtiscali.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.tiscal i.nl>
Els <el*********@PL EASEtiscali.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.ne t | 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*@WINDOZEdig iserv.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*********@PL EASEtiscali.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.tiscal i.nl>
Els <el*********@PL EASEtiscali.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.ne t | 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
3687
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 http://www.example.com RewriteEngine on RewriteRule ^/?(.*).html$ /index.php?content=$1
3
1755
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 get a different error message seemingly already installed somewhere on the server. Does anyone know how to override this? There must be a setting somewhere! Cheers in advance,
15
5149
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 calls to a script which parses the url and produces requested pages. It works fine with browsers, but when I try to validate the page I get a 404 error - which bewilders me, because I thought Apache does the redirection internally without sending...
0
2003
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 just need a short php script that just asks the webserver what the rights are. That seems a reasonable wish to me. If this is however not possible than I'd like a script that can
4
2813
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 AuthName "Foobar" <Limit GET>
1
4899
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 which can override security features you've configured. Here's one way to do it. In the server configuration file, put
2
9256
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 http://cms.mydomain.com/init.php (via ajax request) example2: <script src="http://host1.mydomain.com/cms/example.js" in <html><head> would be parsed from http://cms.mydomain.com/example.js physically there are no cms directories in...
2
6005
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 alice.html, and of course .htaccess (all in the root directory). What I want to happen is have bob.html show up when I visit alice.html, so I put this in .htaccess: RewriteEngine on RewriteRule ^alice\.html$ bob.html .htaccess does not seem to...
8
3467
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
9535
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10244
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10201
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5454
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.