473,788 Members | 3,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert PHP addresses to HTML

IWT
Ive heard about some sort of script or program that converts a web
address with a php extension to that with a html. E.g. say if you had
www.abc.com/123.php the user would be able to access this via
www.abc.com/123.html.
We're creating a new site in php and dont want to effect our search
engine rankings by getting rid of all our existing html pages.

Any information would be appreciated.

Cheers,

Tom

Oct 14 '05 #1
5 2099
IWT schrieb:
Ive heard about some sort of script or program that converts a web
address with a php extension to that with a html. E.g. say if you had
www.abc.com/123.php the user would be able to access this via
www.abc.com/123.html.
We're creating a new site in php and dont want to effect our search
engine rankings by getting rid of all our existing html pages.

Any information would be appreciated.

Cheers,

Tom

Hi,

edit your httpd.conf or set a .htaccess file with this contens

AddType application/x-httpd-php php php4 php3 html htm

Then you are able to save your php files with the extension .html and
the parse will be activated at request.

Kirsten
Oct 14 '05 #2
IWT wrote:
www.abc.com/123.php the user would be able to access this via
www.abc.com/123.html.


You could use
1) symbolic links in the file system (unix command ln -s),
2) redirects in html header from html to php file,
3) apache rewrite engine (see manual on apache.org),
4) add .html extension as type for php parsing in httpd.conf;
and maybe other approaches as well.

--
E. Dronkert
Oct 14 '05 #3
"IWT" wrote:
Ive heard about some sort of script or program that converts a web
address with a php extension to that with a html. E.g. say if you had
www.abc.com/123.php the user would be able to access this via
www.abc.com/123.html.
We're creating a new site in php and dont want to effect our search
engine rankings by getting rid of all our existing html pages.


Are you on an Apache server? If so, try putting this in your .htaccess file:

RewriteEngine on
RewriteRule ^(.*)\.html$ $1 [C,E=dothtml:tru e]
RewriteCond %{REQUEST_FILEN AME}.php -f
RewriteRule ^(.*)$ $1.php [S=1]
RewriteCond %{ENV:dothtml} ^true$
RewriteRule ^(.*)$ $1.html

If your server receives a request for "/path/to/foo.html", it will first
check to see if a file "/path/to/foo.php" exists. If so, it serves up the
PHP file, otherwise the HTML file gets sent out.

If you're not on an Apache server, then you might be stuck. Ask your hosting
company what your options are.

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
Oct 14 '05 #4
You have two options, both involve messing around with your Apache
config.

The first is to include a rewrite rule in the config that is something
like the following:
RewriteRule ^(.*)[.]html$ $1.php [L,QSA]
Which redirects all requests for foo.htm to foo.php

The second is to tell Apache to process .html files as PHP. Find the
following line in your apache conf:
AddType application/x-httpd-php .php
And change it to:
AddType application/x-httpd-php .php .html

Note that this would mean all .html files are run through the PHP
engine, which will probably increase the load on your server. You can
get fancier and restrict the rule by directory, if that helps.

-Ciaran

Oct 14 '05 #5
IWT wrote:
www.abc.com/123.php the user would be able to access this via
www.abc.com/123.html.


Better still, redirect both of those URLs to:

www.abc.com/123

which might be PHP now, but after a future site revision might become a
PDF file, or perhaps a JSP script.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Oct 15 '05 #6

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

Similar topics

17
14073
by: Andrew McLean | last post by:
I have a problem that is suspect isn't unusual and I'm looking to see if there is any code available to help. I've Googled without success. Basically, I have two databases containing lists of postal addresses and need to look for matching addresses in the two databases. More precisely, for each address in database A I want to find a single matching address in database B. I'm 90% of the way there, in the sense that I have a simplistic...
5
18029
by: Andrew V. Romero | last post by:
At work we have an excel file that contains the list of medications and their corresponding strengths. I would like to save the excel file as a text list and paste this list into a javascript function and have JS put this into an array. Then JS would use this array to create a selection list which displays only the names of the drugs. When the user selections one of the drugs, another selection list will be loaded with the avaiable...
6
445
by: Red Devil | last post by:
I have a class containing string variables, hashtables..I managed to serialize it into a memory stream instead of file stream. Would like to know how can I convert the byte array to string. I tried using encoding.default.getstring but the output is an empty string..(:..damn! partial code example that copied for microsoft for testing purpose: Dim addresses As New Hashtable addresses.Add("Jeff", "123 Main Street, Redmond, WA 98052")...
24
7131
by: Arno R | last post by:
Hi all, I have a client with several shoe-shops. Customers can leave their email-address if they want to be notified when there is a sale. Input is validated with instr() I am checking for @ and . (required) and also checking for spaces (not allowed). But: A LOT (5-10%) of the addresses still are wrong; (provider doesn't exist) or email-address not valid (anymore). When sending bulk-mail its a nasty problem to get the false addresses...
87
3374
by: j0mbolar | last post by:
I've read in the standard that addresses basically can't be interpreted as integers. If they can, it is implementation defined behavior. However, if they can't be viewed as integers in any sense as far as portability goes, what then, should one think of addresses being composed of?
12
1685
by: MARTIN LANNY | last post by:
Hi All, In my program I am loading the content of a text file (main.txt) into a string called 'message'. What I need is to convert all urls and emails in this string into html. This is what I did to convert hard returns to <br>'s and it works fine: Dim sws As New IO.StreamWriter(pathtosave)
13
9248
by: Jason | last post by:
Could someone here show me how I would write a vb program to convert decimal ip address to binary? For example a small form with a convert button and a label for the result and a textbox for the ip. So I would want 11000000 10101000 00000010 00001010 tp show up inthe label if I entered 192.168.2.10 into the text box. I have no idea even how to begin this, any help would be great.
4
2768
by: SAL | last post by:
I am using a RegularExpressionValidator control on my ASP page, and I have the ValidationExpression property set to "Internet E-mail Address". The email address is valiated when the user puts in a email addess in the TextBox. This works fine until I have multiple email addresses. How can I validate multiple e-mail addresses seperated by a "," or ";"? The following ValidationExpression will validate up to 2 email addresses but not...
14
9298
by: Simon | last post by:
Hi, is there a straight forward way of converting IPv4 to IPv6? I thought that it was just a matter of converting 32 bits to 128 bits, (by adding 96 leading 0s), but that does not seem right in some/most cases. For example, 127.0.0.1, (IPv4 localhost), does not convert ::1, (IPv6 localhost)
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
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...
0
9964
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
8993
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...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
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...
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.