Solved

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

Posted on 2008-09-30
5
283 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
  • 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

747 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now