Solved

calling php without having the page extension = .php

Posted on 2003-11-28
4
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
vincevincevince earned 50 total points
ID: 9837038
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
ID: 9840758
Thanks! it works!
0
 
LVL 1

Expert Comment

by:vincevincevince
ID: 9841831
I'm glad to hear that.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

730 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