Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Reply
whats the .htaccess URL rewrite code to do send from *.html to *.php
Old 11-24-2008, 10:00 PM whats the .htaccess URL rewrite code to do send from *.html to *.php
TWD
TWD's Avatar
King Spam Talker

Posts: 1,112
Trades: 0
I've read a few tutorials but haven't had any luck.

If somebody types www.mysite.com/index.html, or even www.mysite.com/index.htm or www.mysite.com/index.shtm

into a browser I'd like to re-direct to

www.mysite.com/index.php
TWD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-24-2008, 10:52 PM Re: whats the .htaccess URL rewrite code to do send from *.html to *.php
transcendev's Avatar
Novice Talker

Posts: 8
Name: Mike
Location: Montgomery, IL
Trades: 0
RewriteRule ^index.(.*)$ index.php [L]
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
transcendev is offline
Reply With Quote
View Public Profile Visit transcendev's homepage!
 
Old 11-25-2008, 01:28 AM Re: whats the .htaccess URL rewrite code to do send from *.html to *.php
Banned

Latest Blog Post:
Oscar: The Bionic Cat
Posts: 237
Trades: 0
this one really helps: http://httpd.apache.org/docs/1.3/howto/htaccess.html
bogs is offline
Reply With Quote
View Public Profile Visit bogs's homepage!
 
Old 11-25-2008, 07:38 PM Re: whats the .htaccess URL rewrite code to do send from *.html to *.php
TWD
TWD's Avatar
King Spam Talker

Posts: 1,112
Trades: 0
Quote:
Originally Posted by transcendev View Post
RewriteRule ^index.(.*)$ index.php [L]
Thanks a lot! That really works.
Now is there a way to create a kind of wild card setup so that it takes ANY file with an incorrect file extension and looks for the equivalent named file as .php
In other words do the same as above for EVERY file, not just the index file?

Sorry but I dont know regex expressions.
TWD is offline
Reply With Quote
View Public Profile
 
Old 11-25-2008, 10:31 PM Re: whats the .htaccess URL rewrite code to do send from *.html to *.php
transcendev's Avatar
Novice Talker

Posts: 8
Name: Mike
Location: Montgomery, IL
Trades: 0
That would be a tough one.
Without getting too advanced, you could do things like:
RewriteRule ^(.*).html$ $1.php [L]
RewriteRule ^(.*).htm$ $1.php [L]
RewriteRule ^(.*).shtml$ $1.php [L]

Which would basically rewrite any .html, .htm or .shtml page as a .php page.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
transcendev is offline
Reply With Quote
View Public Profile Visit transcendev's homepage!
 
Old 11-26-2008, 06:16 AM Re: whats the .htaccess URL rewrite code to do send from *.html to *.php
TWD
TWD's Avatar
King Spam Talker

Posts: 1,112
Trades: 0
Quote:
Originally Posted by transcendev View Post
That would be a tough one.
Without getting too advanced, you could do things like:
RewriteRule ^(.*).html$ $1.php [L]
RewriteRule ^(.*).htm$ $1.php [L]
RewriteRule ^(.*).shtml$ $1.php [L]

Which would basically rewrite any .html, .htm or .shtml page as a .php page.
It's a partial success!
Works fine for url requests with a .html or .htm extension.
They get sent to the correct .php page just fine.

Doesn't work for .shtml requests.

Hmmmm.

Any ideas..anyone?
TWD is offline
Reply With Quote
View Public Profile
 
Old 11-26-2008, 12:55 PM Re: whats the .htaccess URL rewrite code to do send from *.html to *.php
transcendev's Avatar
Novice Talker

Posts: 8
Name: Mike
Location: Montgomery, IL
Trades: 0
Are your pages .shtml or .shtm? Just noticed in your original example you said .shtm.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
transcendev is offline
Reply With Quote
View Public Profile Visit transcendev's homepage!
 
Old 11-26-2008, 07:29 PM Re: whats the .htaccess URL rewrite code to do send from *.html to *.php
TWD
TWD's Avatar
King Spam Talker

Posts: 1,112
Trades: 0
Quote:
Originally Posted by transcendev View Post
Are your pages .shtml or .shtm? Just noticed in your original example you said .shtm.
Actually neither. All my pages are .php

I guess that since .html, .htm, .shtml and .shtm are all valid file extensions I was looking for a way to re-direct ALL these file URL file requests to my .php files.
TWD is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to whats the .htaccess URL rewrite code to do send from *.html to *.php
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26877 seconds with 12 queries