Forum Moderators: open
The correct URL that should be indexed is www.mydomain.com/some_directory/another_directory/file_name.aspx?id=97&some_parameter=some%20variable%20stuff
Since the id is the same, all the page content is the same for both URL's. Google probably has multiple URL's for the same content indexed, so to avoid a duplicate content issue and be sure all the link equity (both externally and internally) is flowing to just one version of the page we want indexed, we need to do a 301 redirect of any URL's in this form:
www.mydomain.com/some_directory/another_directory/file_name.aspx?id=97
Or
www.mydomain.com/some_directory/another_directory/file_name.aspx?id=97&some_parameter=some%20incorrect_variable%20stuff
To the correctly formatted URL of:
www.mydomain.com/some_directory/another_directory/file_name.aspx?id=97&some_parameter=some%20variable%20stuff
I assume we need to install a ASP.NET script of some sort on file_name.aspx. Does anybody have that script handy or know of any kind of solution?
I am not a programmer, so sorry if my question and explanation does not use the correct terminology. I really appreciate any help any body may have.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myID As Integer
Dim myParameter, myCorrectParameter, myNewURL As String
' Get the Query String values
myID = Request.QueryString("id")
myParameter = Request.QueryString("some_parameter")
If myParameter <> "WhateverYouExpected" Then
myCorrectParameter = "WhateverItShouldBe"
myNewURL = String.Format("www.mydomain.com/some_directory/another_directory/file_name.aspx?id={0}&some_parameter={1}", myID.ToString(), myCorrectParameter)
Response.Status = "301 Moved Permanently"
Response.AddHeader("Location", myNewURL)
Else
' do whatever You would have done otherwise
End If
End Sub