Welcome to WebmasterWorld Guest from 54.159.190.106

Forum Moderators: phranque

Message Too Old, No Replies

301 redirect from .htm to .php

host says cannot do

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

10+ Year Member



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)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.

Jim

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

10+ Year Member



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)

10+ Year Member



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)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.

Jim

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

10+ Year Member



Thanks to you both, I appreciate the quick responses
10:16 am on Jan 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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)

10+ Year Member



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]
 

Featured Threads

Hot Threads This Week

Hot Threads This Month