Unstoppable Domains

Changing .php to .htm Help!

Spaceship Spaceship
Watch

gobbly2100

Established Member
Impact
1
Hi there,

I hope someone can help but I am running a .htm based site and I want to upgrade it to a PHP but keeping the extentions as .htm so I don't lose positions and ranks in search engines.

I am trying to use a .htaccess file to do the job but as I am a total noob to using it I need help, do I have to add anything to my actual pages for this to work?

This line is what I found on a website but I dunno if I have to edit it atall or what I need to do with it.

# Make PHP code look like other code types
AddType application/x-httpd-php .htm


I really am lost and would be greatful for some help, thanks in advance to any helpers.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
0
•••
rewriteengine on
rewriterule (.*).htm $1.php

that should do it
just place in .htaccess and tell me what happens
 
0
•••
Oh wicked, that works great.

Thankyou so much for helping me there, it was driving me crazy not knowing how to do it.

What was all that about that I had with all the AddType stuff?
 
0
•••
I think the code you originally posted would have worked, as that would have told the server to treat the htm files a php documents
 
0
•••
Use dreamweaver, just open your html in dreamweaver and save as php
 
0
•••
Why would you want to do this anyway, .php can read .htm too, plus if you want to put a header or something little in php it still works, i would definitly stay with the .php.
 
0
•••
I would most certainly leave the extension at a PHP. Why would you even switch it to HTM? If anything I could see you switch it to HTML, but even that isn't the wisest suggestion.
 
0
•••
freedy, MarcL, and LeetPCUSer you mis understood his post. The files are currently .htm and he wants to add PHP into these files, thus change the extension, but he wants this change to be transparent to the user. (so the user thinks they're going to mypage.htm when they're really going to mypage.php) The Rewrite rule above should work fine.
 
0
•••
Create a .htaccess and put the following
Code:
RewriteEngine on
RewriteRule ^NAME/?$ NAME.php
Change NAME.php to the actual file's name and the first NAME to what you want to name the .html file.
 
0
•••
i think the pr was the factor here .I ran into same issue an dmy inner pages were pr4 and when i changed the extention they went to PR0.
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back