homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

301 redirect from .htm to .php
host says cannot do

 2:49 pm on Jan 2, 2005 (gmt 0)

I am about to switch from static(.htm) to dynamic(.php). As I now have high SE rank directly to my static pages for each of my important keywords, I wanted to do a 301 redirect from each of those pages. My host (Windows) sent the following message:
"You cannot perform a 301 redirect based on the extension (.htm, static pages) requested by visitor from the web server."
They suggest a custom 404 page redirecting to the new "main.php", but this is not how I want to do it. Is this a problem with my host that I should consider moving to a new one or what?



 3:09 pm on Jan 2, 2005 (gmt 0)

RedirectMatch [httpd.apache.org] in Apache mod_alias or RewriteRule [httpd.apache.org] in Apache mod_rewrite can easily be used to redirect based on filetype. If your host supports either of those modules, you should be able to do this easily.

However, you might consider simply using mod_rewrite to do an internal rewrite from .htm to .php, and leaving your current URLs alone. It's just as easy as redirecting, and has the advantage of not affecting your search listings and visitors' existing bookmarks. Using an internal rewrite, you change the relationship between the publically-visible URL (.htm) and the server filename (.php) that that URL refers to. For an example, you have to look no further than the address bar in your browser right now... This site is dynamic, but presents static URLs for most functions.



 3:46 pm on Jan 2, 2005 (gmt 0)

The host is a Windows server. Excuse my ignorance, but will what you suggest work on non-Apache server?


 4:09 pm on Jan 2, 2005 (gmt 0)

Maybe you can use
<meta HTTP-EQUIV="Refresh" CONTENT="0; URL=page.php">
in page.html etc until your php pages get indexed (a few months and then .html pages can be removed).


 4:48 pm on Jan 2, 2005 (gmt 0)

Sorry, I missed the Windows reference. ISAPI Rewrite is available for Windows servers, but I doubt that your host will support it (it's not included with IIS, and must be purchased).

As much as I dislike meta-refreshes and all the trouble they have caused in the search engines recently, that may indeed be your best bet on a shared Windows hosting account.



 6:58 pm on Jan 2, 2005 (gmt 0)

Thanks to you both, I appreciate the quick responses


 10:16 am on Jan 7, 2005 (gmt 0)

You can get cheap high quality hosting where questions like these won't arise. I'd seriously consider moving hosts.


 11:02 am on Jan 7, 2005 (gmt 0)

Maybe you can ask the host to configure IIS in such a way that it invokes PHP for requests to files ending in .HTML instead of the standard .PHP? Theoretically it should be possible but I have never done so myself. For instructions you could point them here. [php.net]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved