File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes controlling what appears in the browser url window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "controlling what appears in the browser url window" Watch "controlling what appears in the browser url window" New topic
Author

controlling what appears in the browser url window

paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20729
    ∞

So I have a web page at www.richsoil.com/lawn and people are linking to it. Only when the page comes up, it comes up as www.richsoil.com/lawn/index.jsp - I'm worried that google with think these are two different pages and rank them each half as well as if all links were to www.richsoil.com/lawn

how do I get the page to stay www.richsoil.com/lawn so that people can copy the right thing?
[ August 18, 2007: Message edited by: paul wheaton ]

permaculture Wood Burning Stoves 2.0 - 4-DVD set
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You could add something like

<script>
var indexLocation = window.location.href.indexOf("index.html");
if(indexLocation != -1)
window.location.href = window.location.href.substr(0,indexLocation);
</script>

but that is only going to help people that have JavaScript enabled and Google bot is not JavaScript enabled.

The best solution is a serverside solution.

Eric
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by paul wheaton:
So I have a web page at www.richsoil.com/lawn and people are linking to it. Only when the page comes up, it comes up as www.richsoil.com/lawn/index.jsp - I'm worried that google with think these are two different pages and rank them each half as well as if all links were to www.richsoil.com/lawn

how do I get the page to stay www.richsoil.com/lawn so that people can copy the right thing?

[ August 18, 2007: Message edited by: paul wheaton ]


What application server are you using and how are you setting it up to use index.jsp?

In Tomcat, if I set up index.jsp to be a welcome-file in the welcome-file-list, I never see the 'index.jsp' part in the URL.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: controlling what appears in the browser url window