Solved

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

Posted on 2008-09-30
5
289 Views
Last Modified: 2013-12-25

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
Comment
Question by:pigmentarts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 27

Expert Comment

by:azadisaryev
ID: 22606619
put a meta refresh tag in your index.html page?
0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 22606635
but if you have access to your web server you better setup a redirect for index.html there.
0
 
LVL 9

Accepted Solution

by:
Andrew Maurer earned 250 total points
ID: 22607522
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
 
LVL 12

Author Comment

by:pigmentarts
ID: 22613038
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
 
LVL 27

Assisted Solution

by:azadisaryev
azadisaryev earned 250 total points
ID: 22615326
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

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question