Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-09-30
5
Medium Priority
?
295 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 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

704 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