Solved

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

Posted on 2013-01-17
4
215 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 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Generate PDF from MySQL using PHP 3 52
Change static entered data to dynamic with counter 5 32
$_GET call between URL 3 37
Get data from two MySQL tables 6 18
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

685 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