Solved

calling php without having the page extension = .php

Posted on 2003-11-28
4
245 Views
Last Modified: 2006-11-17
Dear All,

I have a html page which would like to include a php script to it, the script is to check the current page URL and if the address is a "specific" address, the page would be redirect to a blank page.

The script is tested and ok, but I don't know how can I add it to the html page..as I don't want to change the page extension from html to php.

I have tried to use an image <img src="myscript.php" width="0" height="0"> but it seems that the script doesn't work.

I have also tried to use js instead..but as I can only include the script in onLoad section, the page may be loaded before the script takes action.

please advise on how can I do that..thanks!
0
Comment
Question by:ping1234
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
vincevincevince earned 50 total points
Comment Utility
make a file called ".htaccess" (apache only)
put it in the root of the folder
put in the file just the following line:
AddType application/x-httpd-php .php .php3 .html .htm

this will instruct php to parse the htm or html pages without a change in extension
then just put in your html page <?php include("myscript.php"; ?>
0
 

Expert Comment

by:esther_6694
Comment Utility
Thanks! it works!
0
 
LVL 1

Expert Comment

by:vincevincevince
Comment Utility
I'm glad to hear that.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now