• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

301 redirect to detect page and redirect in static page?????


i need to put a 301 redirect so if a user is on mydomain.com/index.html then it will point to  mydomain.com/ same page but i know

I know in ColdFusion i can use i mix of cgi and a redirect 301 using cflocation however this is a html page.
0
pigmentarts
Asked:
pigmentarts
  • 3
2 Solutions
 
azadisaryevCommented:
put a meta refresh tag in your index.html page?
0
 
azadisaryevCommented:
but if you have access to your web server you better setup a redirect for index.html there.
0
 
Andrew MaurerCommented:
Redirection with Javascript or META tags
If you don't have server-side scripting or mod_rewrite on your web server, you can still do redirection, but not as elegantly. The Javascript/META method will redirect after both the headers and the page have loaded. By contrast, the HTTP header method described above redirects immediately after the headers have loaded. While both methods require two requests to the web server, the Javascript/META method causes the user's browser to flicker or refresh as the old page is loading. Redirection with HTTP headers is seamless, and saves time.

You can not send a 301 status code via Javascript or META tags. Since the HTTP status code of the page will remain 200 OK, most search engines will continue to think the location is valid. Any page rank of the old location will not be transferred to the new location.

Another disadvantage is that some browsers disable Javascript or META refresh. Therefore, one must include a link to the destination page in the body of the page. One can also add a delay between when the page is displayed, and when it redirects. However, I would strongly discourage this and will not even describe it here.

Unfortunately, it is very common to see delayed META/Javascript refresh used when a site or page has moved. The page typically shows a message saying, "This site has moved to ... Your browser will be automatically forwarded in X seconds. Click here if your browser does not automatically forward you." Some website, particularly government and legal websites, add such an intermediate page whenever you click a link to an external site.

Not only is this search-engine unfriendly, but it has the additional drawback of wasting the visitor's precious time while they read wholly unneccessary information and wait for the redirect. The first rule of web design (and writing) is to treat your reader's time with respect. All visitors except the most novice can tell when they are leaving your site for another, and that your site has no authority over the external site, so there is no need to waste everyone else's time.

Article found at http://www.somacon.com/p145.php
0
 
pigmentartsAuthor Commented:
azadisaryev: if i was to just put a meta refresh script in the index.html page if would also run when the user accessed www.mydomain.com/ i would then just get suck in a endless loop

i am tring to forward this www.mydomain.com/index.html to this www.mydomain.com/i
0
 
azadisaryevCommented:
you can remove index.html from default documents for your site, so that page is never requested by default if no page is specified.

but may i enquire WHY you need such a 301 redirect? for what purpose?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now