Solved

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

Posted on 2013-01-17
4
217 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
[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 83

Expert Comment

by:Dave Baldwin
ID: 38788404
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
ID: 38788451
0
 

Author Comment

by:milani_lucie
ID: 38788674
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
ID: 38789536
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
This article discusses how to create an extensible mechanism for linked drop downs.
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 dynamically set the form action using jQuery.

728 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