Solved

How to map "http://SampleWebSite.com/Test" to "http://SampleWebSite.com/Test.htm" - PHP

Posted on 2013-01-17
4
211 Views
Last Modified: 2013-01-17
Hi,

When users request the URL like this

http://SampleWebSite.com/Test

then, i want to map that one to

http://SampleWebSite.com/Test.htm

in PHP. Can you please provide me sample code for that ? And let me know where i have to make changes.

Thanks
0
Comment
Question by:milani_lucie
  • 2
4 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
As I told you in your other question, PHP can not do this.  It must be done by the web server in order to avoid getting a "404 File Not found" error.
0
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 500 total points
Comment Utility
0
 

Author Comment

by:milani_lucie
Comment Utility
I have this code in htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]

But it never works for me. When user hits by using this URL:

http://Site1.com/knowthecode

It is not picking up the

http://Site1.com/knowthecode.html

file. Can you point me in right direction ?

Thanks
0
 

Author Comment

by:milani_lucie
Comment Utility
DaveBaldwin,

Can you please let me know how to set that (Redirection) in IIS. If you hit a page then we can have code in that page to handle the redirection. But my url is just :  http://Site1.com/knowthecode

Thanks
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

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

8 Experts available now in Live!

Get 1:1 Help Now