milani_lucie
asked on
How to map "http://SampleWebSite.com/Test" to "http://SampleWebSite.com/Test.htm" - PHP
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
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
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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
ASKER
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
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