Creating HTTP 301 redirect (Full Version)

All Forums >> [Web Development] >> Search Engine Optimization and Web Business



Message


pimpernel -> Creating HTTP 301 redirect (12/30/2004 12:46:28)

Hi. Apologies if this is on the wrong board.

About 8 weeks ago I published a newly designed site to replace my original one. The URL is the same as it was but unfortunately, whereas my original home page was default.htm I was advised to name my new home page index.htm for publishing purposes. Now I find that some keyword searches on Google are bringing up my original home page complete with the default.htm, so naturally because that page no longer exists it is a dead link. The other pages on my site still retain the same names so visitors end up at the correct page anyway so no problem there. It's only the old home page creating the problem. Am hoping that eventually IF and when my new home page is crawled and If it appears on Google then the old links may die out but am not confident.

I am told to use HTTP 301 redirect but surely that is impossible because there is no such page in my site named 'default.htm anymore.

The people who link to me all use the .com URL they do not use the default or the index htm so that is not a problem.

If anyone can advise me further I would be very grateful. Perhaps I should sit tight and be patient??

Thank you and best wishes for 2005






dpf -> RE: Creating HTTP 301 redirect (12/30/2004 12:55:03)

quote:

whereas my original home page was default.htm I was advised to name my new home page index.htm for publishing purposes
just curious - why did they say you "had to" change it? default is perfectly legit.




pimpernel -> RE: Creating HTTP 301 redirect (12/30/2004 13:44:06)

Hi Dan.

I had a few problems when I published my original site and finally it could only be corrected by renaming my home page. This time I thought I would be prepared so enquired in advance what my home page should be called. If I remember correctly the list I was given showed index.htm as the preferred choice with default.html lower down on the list. I do not think default.htm was there.

With hindsight I should have kept default but to be on the safe side and because of my inexperience with such matters I played safe. More fool me!!

Cheers




Reflect -> RE: Creating HTTP 301 redirect (12/30/2004 13:44:42)

Create a blank page called default.htm. Then implement the following...

http://www.seoconsultants.com/tips/asp/301.asp

This will redirect the SE spider to the correct page.

Take care,

Brian




pimpernel -> RE: Creating HTTP 301 redirect (12/30/2004 14:23:07)

Ooo err! Is it as simple as that?

Thank you, I will go read the link now. One other question arises though...Once I have set that up do I keep the blank page in my web or would it be better to delete it at a later stage?

[:)]




dpf -> RE: Creating HTTP 301 redirect (12/30/2004 14:26:38)

i guess it is that simple, i was thinking something along those lines but kept quiet cause i wasnt sure..we all learn sometimes.. but as to keeping the page - yes. as long as its being picked up in SE




Reflect -> RE: Creating HTTP 301 redirect (12/30/2004 16:20:31)

Yes, keep the page temporarily. Once you see default fall in the SERPS then remove it.

Take care,

Brian




BobbyDouglas -> RE: Creating HTTP 301 redirect (12/30/2004 17:22:45)

Brian,

I have noticed this takes a couple months to see results from the 301. What have you experienced with this?




pimpernel -> RE: Creating HTTP 301 redirect (12/30/2004 17:59:48)

This probably seems a very basic and stupid question. The old non-existant page causing the problem was "http:www.myurl.com/default.htm"

Can I confirm that the redirect 301 HTTP address (the "Location") will be: "http:www.myurl.com/index.asp as opposed to /index.htm

Presumably my dead link OUGHT to disappear from Google eventually anyway (whether I do the HTTP 301 redirect or not)? Hopefully by that time my correct new page with new tags etc will have appeared in the listing.

Patience is indeed a virtue!

Thanks everyone.




Reflect -> RE: Creating HTTP 301 redirect (1/4/2005 14:08:20)

quote:

Can I confirm that the redirect 301 HTTP address (the "Location") will be: "http:www.myurl.com/index.asp as opposed to /index.htm


That can only be confirmed by you and your host. With IIS you can specify .htm/.html/.asp as being the default via your host or your control panel access.

quote:

Presumably my dead link OUGHT to disappear from Google eventually anyway (whether I do the HTTP 301 redirect or not)? Hopefully by that time my correct new page with new tags etc will have appeared in the listing.


Correct or you can request a removal here...

http://www.google.com/remove.html#exclude_pages

quote:

I have noticed this takes a couple months to see results from the 301. What have you experienced with this?


Been too long to remember I did this around one year ago when making a lot of changes for a client. Back then it took around 1 to two months, might have been the timing of the crawl.

Take care,

Brian




jaybee -> RE: Creating HTTP 301 redirect (1/5/2005 10:32:33)

Can I ask why you're using all of that rather than the Meta Tag?

<meta http-equiv="refresh" content="5; url=http://www.yourweb.com/~username/filename.html">

This redirects in 5 seconds. Change to 0 for instant.




pageoneresults -> RE: Creating HTTP 301 redirect (1/5/2005 11:51:23)

quote:

Create a blank page called default.htm. Then implement the following...

http://www.seoconsultants.com/tips/asp/301.asp

This will redirect the SE spider to the correct page.

I've got to correct something here. The above method only works with .asp pages. The asp code for the redirect will not work on an .htm or .html page.

You would have been better off to have kept the default.htm for your root level page. Why? Because there may be many inbound links that use a full URI including the /default.htm file reference. This can be a real pain as I'm about to explain.

When you change anything with a file name, extension, underlying technology, etc., you have to be careful that you put something in place to capture those visitors visiting an old URI reference. URI stands for Uniform Resource Identifier and is used in place of URL which has been deprecated (in the specifications). Anyway, back to the topic...

When you are building your site, one thing you want to absolutely make sure of, is that you don't link to root level pages. For example, here is how a link would be constructed for your home page...

http://www.example.com/

Here is how a link would be constructed for a home page in a sub-directory...

http://www.example.com/sub/

Notice that I did not include the index.htm or whatever the home page may be called. You can literally name that root level page anything as long as your host has made certain changes in IIS to reflect that. I prefer index.asp or index.htm. They are the simplest and shortest of the available options and are pretty much the standard these days.

So what may have happened in this case is that you had internal links within your site that pointed to /default.htm. Many times you will see your search engine listing with this full URI. You don't want that! You want that root address pointing to http://www.example.com/

Follow me on all of this? ;)

Now, to address your issue. The best thing would be to have the host install ISAPI_Rewrite and then you can drop an ini file in your root that will handle this with no problems. Or, ask your host what type of solution they can provide for you in this particular case. From my perspective, the ini file is absolutely the best option. 2nd best option would be to have the host set up a 301 for you through IIS.




dpf -> RE: Creating HTTP 301 redirect (1/5/2005 11:53:27)

quote:

ini file
can you describe that in more detail please.




davids -> RE: Creating HTTP 301 redirect (1/5/2005 11:53:33)

Many thanks, Brian! I've been looking for that for quite a while.




pageoneresults -> RE: Creating HTTP 301 redirect (1/5/2005 12:02:12)

quote:

Can you describe that in more detail please.

With ISAPI_Rewrite, there is a global .ini file that is installed at the root of the server. The host can do a variety of things with this file or they can just leave it be.

After that global ini file is installed, now each and every site on that server can used the httpd.ini file which is similar to Apache's mod_rewrite. They both function the same way and use Regular Expressions.

Unfortunately the above method is not going to be available to most as many hosts are fearful of installing anything on their Windows Server like this. What they fail to realize is that the ISAPI filter causes no harm if configured properly. It requires someone with the knowledge of writing Regular Expressions and rewrite routines.




pageoneresults -> RE: Creating HTTP 301 redirect (1/5/2005 12:07:12)

Here's an example of one line that would go in the .ini file to address this particular issue...

RewriteRule /default.htm http://www.example.com/ [I,O,RP,L]




minstrel -> RE: Creating HTTP 301 redirect (1/5/2005 12:08:58)

quote:

ORIGINAL: jaybee

Can I ask why you're using all of that rather than the Meta Tag?

<meta http-equiv="refresh" content="5; url=http://www.yourweb.com/~username/filename.html">

This redirects in 5 seconds. Change to 0 for instant.

This will work but do NOT use a value less than 10 -- and definitely do NOT use 0 -- this may be interpreted by some search engines as "cloaking".

Create a page as follows:
[CODE]<HTML>
<HEAD>
<META HTTP-EQUIV="REFRESH"
CONTENT="10; URL=http://www.yourdomain.com/newpage.html">
<TITLE>This page has moved</TITLE>
</head>
<BODY>

<P>This Page Has Moved<BR>
Please update your bookmarks to
<A href="http://www.yourdomain.com/newpage.html">
http://www.yourdomain.com/newpage.html</A>
</p>
</body>
</html>[/CODE]

Alternate methods for redirect:

1. if your host allows an .htaccess file (Unix/Linux/Apache), you can use a 301 redirect:
[CODE]Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html[/CODE] or
[CODE]Redirect permanent /oldpage.html http://www.yoursite.com/newpage.html[/CODE]

Or this will redirect ALL pages from an old site to a new site:

[CODE]redirect 301 / http://www.yourdomain.com/[/CODE]

2. 301 redirect in PHP
To use the following PHP code you must change the file extension of the file you will be using to index.php instead of index.html.

Now put the following code into your new index.php page, put ONLY this code, no need for <head>, <body> or any other tags.

Change www.newdomain.com/page.html to the url the page will be redirecting to
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newdomain.com/page.html");
exit();
?>

3. 301 redirect in ASP: To use the following ASP code you must change the file extension of the file you will be using to default.asp instead of default.html. Now put the following code into your new default.asp page, put ONLY this code, no need for <head>, <body> or any other tags.

Change www.newdomain.com/page.html to the url the page will be redirecting to
<%
response.Status = "301 Moved Permanently"
response.addheader "location", "http://www.newdomain.com/page.html"
response.end
%>




dpf -> RE: Creating HTTP 301 redirect (1/5/2005 14:41:06)

quote:

Regular Expressions
ty..just curious- are those the same or similar Regular Expressions I learned in Javascript?




Reflect -> RE: Creating HTTP 301 redirect (1/5/2005 15:37:58)

Dam Ed, you're right I forget the page type. My profuse apologise Pimpernil [8|].

On the META the reason I do not use this for this situation is a 301 means the page has been permanently moved.

Take care,

Brian




jaybee -> RE: Creating HTTP 301 redirect (1/5/2005 16:47:52)

quote:

this may be interpreted by some search engines as "cloaking".


quote:

301 means the page has been permanently moved


Thanks, that answers my question. I've never had to use redirects but I'm modding a big site at the moment using SSIs and will have to change all the page names to shtml from html. The site has a really good ranking for a lot of pages and I don't want people getting 404 all over the place.




pageoneresults -> RE: Creating HTTP 301 redirect (1/5/2005 22:37:12)

quote:

I've never had to use redirects but I'm modding a big site at the moment using SSIs and will have to change all the page names to shtml from html.

Why do you have to do that? I do believe you can handle the interpretation of shtml to html at the server level. You shouldn't have to switch any file extensions to shtml. Or at least I don't think so... I've only worked with FP, asp and a few php include methods.




minstrel -> RE: Creating HTTP 301 redirect (1/5/2005 22:42:42)

It may depend on the host. One of my sites was previously hosted on a server where they required shtml for SSIs.




pageoneresults -> RE: Creating HTTP 301 redirect (1/5/2005 22:45:16)

quote:

ty..just curious- are those the same or similar Regular Expressions I learned in Javascript?

I think so. Regular Expressions are Regular Expressions, aren't they? :)

Here are a few ISAPI Rewrite Tips that we have published that are related to this topic.

One thing I did forget to mention, with ISAPI_Rewrite installed (the global .ini), each site can now have it's own httpd.ini file. The .ini files are controlled at the root level of each site so the host need not get involved if you know what you are doing. There is a generated .txt log file of any errors that may occur which are usually none if done correctly.




jaybee -> RE: Creating HTTP 301 redirect (1/6/2005 5:09:09)

I've tried it without shtml and it doesn't bring the includes in.

However, the host uses Fantastico and there is a neat little feature that allows you to do redirects just by filling in the boxes. I'll have a play around once the new stuff is all complete.

I must admit I'd rather they stayed as html if they can but as the site is over 500 pages includes are becoming a must.




pageoneresults -> RE: Creating HTTP 301 redirect (1/6/2005 6:38:50)

quote:

I must admit I'd rather they stayed as html if they can but as the site is over 500 pages includes are becoming a must.

Can you use FP Includes?




jaybee -> RE: Creating HTTP 301 redirect (1/6/2005 7:55:39)

No.

Well, yes, I could but I won't.

I don't use FPSEs.
The site won't be maintained in FP.




pageoneresults -> RE: Creating HTTP 301 redirect (1/6/2005 8:03:53)

Server Side Includes

quote:

Most servers can be configured to "parse" documents that end with .shtml or .shtm file extensions for special commands before sending pages back to clients. Server administrator can also configure servers to parse all .html or .htm files.




jaybee -> RE: Creating HTTP 301 redirect (1/6/2005 9:26:54)

quote:

Most servers


What about "Most hosts" [:D]

I'll have a good snoop round my control panel to see what I can change. Otherwise, I'll mail the host and see what they say. They're normally pretty good.

Thanks




jaybee -> RE: Creating HTTP 301 redirect (1/6/2005 12:06:13)

Just to keep things up to date on the "Jaybee investigates" front

Things got much more complicated as they usually do when I start trying out new ideas in web structure.

I was using SSI for the header, leftcol and rightcol.

As mentioned in previous posts this meant changing all my html files to shtml which was going to cause a problem on the search engine front.

I then decided to really complicate matters by sticking in a breadcrumb menu in which is PHP.

In order for this to work you have to call your pages .php and then the includes don't work.

So, I have now replaced the SSIs with php includes. Anyone know if I can get Apache to parse all html files as php as well?

Will this work?

AddType application/x-httpd-php .php .php3 .php4 .html .htm




jaybee -> RE: Creating HTTP 301 redirect (1/6/2005 12:33:42)

WHOOOO HOOOOO! IT WORKS!!!




Page: [1] 2   next >   >>

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.125