Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-17-2007, 06:06 PM
Junior Member
Latest Blog:
None

 
Join Date: 06-17-07
Posts: 6
iTrader: 0 / 0%
bomy is liked by many
Question 301 asp rewrite?

Hello All

I am new here and have a rather painful question. I have searched and searched for the answer.

I have a site that is about 1 year old. Despite all my best efforts and many errors it ranks #50 to 70 for my main key words but pages 1, 2 or 3 for most of my secondary.

I have had many double indexing problems from the beginning some from linking errors, etc. One problem has occurred because my demo store contained links that link to the hosts server pages.

I am indexed as www.mydomain.com as well as www.mydomain.myhostsname.com. The host address is in the supplemental index in google but in MSN some of those pages actually rank higher than my .com pages.

I

My Windows IIS host said that they would put in some kind of no follow code but I constantly keep getting linked to by these google ad pages that are linking the the hostname address. I still have my entire site indexed under both domains.

I found the following code to use regarding the www vs non www version pages (which I also have a problem with but only in MSN as far as I know)
I need some sort of asp rewrite that will address both issues.

Does anyone know of such a code. I want it to be safe. I can't seem to get rid of these stupid duplicate addresses. My host does not have a rewrite ini file.

Thanks in advance for your input.

Bomy
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #2 (permalink)  
Old 06-17-2007, 06:08 PM
Junior Member
Latest Blog:
None

 
Join Date: 06-17-07
Posts: 6
iTrader: 0 / 0%
bomy is liked by many
Code

Sorry forgot to include the code.


Dim Domain_Name, theURL, QUERY_STRING, HTTP_PATH
Domain_Name = lcase(request.ServerVariables("HTTP_HOST"))
if domain_name <> "www.example.com" Then
HTTP_PATH = request.ServerVariables("PATH_INFO")
If Left(HTTP_PATH, = "/default" Then
HTTP_PATH = ""
End If
QUERY_STRING = request.ServerVariables("QUERY_STRING")
theURL = "http://www.example.com" & HTTP_PATH
if len(QUERY_STRING) > 0 Then
theURL = theURL & "?" & QUERY_STRING
end if
Response.Clear
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", theURL
Response.Flush
Response.End
end if
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #3 (permalink)  
Old 06-17-2007, 06:57 PM
waffles's Avatar
v7n Mental
Latest Blog:

[CaRP] XML error: > required at line 8

 
Join Date: 06-30-06
Location: Not where I want to be.
Posts: 978
iTrader: 1 / 100%
waffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to all
Send a message via AIM to waffles
I know what you need, and unless someone beats me to it I'll be back later with some code that you should be able to copy and paste and use just as I write it.
__________________
Sapid Existence - Finding the beauty in the everyday
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #4 (permalink)  
Old 06-17-2007, 07:10 PM
Junior Member
Latest Blog:
None

 
Join Date: 06-17-07
Posts: 6
iTrader: 0 / 0%
bomy is liked by many
Perfect I'll be checking in, Thanks

Thanks
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #5 (permalink)  
Old 06-17-2007, 07:55 PM
waffles's Avatar
v7n Mental
Latest Blog:

[CaRP] XML error: > required at line 8

 
Join Date: 06-30-06
Location: Not where I want to be.
Posts: 978
iTrader: 1 / 100%
waffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to allwaffles is a name known to all
Send a message via AIM to waffles
Alright, since you're online I'll assume that you're watching this. Do you have the ability to edit your .htaccess file?
__________________
Sapid Existence - Finding the beauty in the everyday
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #6 (permalink)  
Old 06-17-2007, 08:16 PM
Junior Member
Latest Blog:
None

 
Join Date: 06-17-07
Posts: 6
iTrader: 0 / 0%
bomy is liked by many
I wish

They are not on an apache server.

They have Windows IIS so you cannot use the htaccess file. The code that I mentioned regarding the www. vs non www addresses was to be saved as a file named redirect.asp and then added to the top of each file on the site with the following snippet:

<!-- #Include file="redirect.asp" -->

Does this make sense to you? The platform is template style. I do have access to the template html files but not the .asp files.

I hope this all makes sense. When I asked the host for a fix a few months ago they said this "disallow" would work - Not! I am not even sure where they put it. Doesn't show at all from my side (ie robot's text file).

Thanks
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #7 (permalink)  
Old 06-18-2007, 09:25 AM
chicgeek's Avatar
Empress™
 
Join Date: 08-19-04
Location: Canadian in the UK
Posts: 14,213
iTrader: 0 / 0%
chicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest order
I think this belongs more in coding than ASP, but correct me if I'm mistaken.
__________________
laura / chicgeek
soprano & web designer
@chicgeek on Twitter
laurakishimoto.ca
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #8 (permalink)  
Old 06-18-2007, 10:20 AM
Costin Trifan's Avatar
Coding Tiger
 
Join Date: 04-13-07
Location: Romania
Posts: 3,308
iTrader: 0 / 0%
Costin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest order
Send a message via Yahoo to Costin Trifan
Hey, bomy ! Welcome to the forums!

well, this is your code:

Code:
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) MyBase.OnLoad(e) Response.Status = "301 Moved Permanently" Response.AddHeader("Location", "http://where-to-redirect") Response.End() End Sub
"http://where-to-redirect = add the url where you want uer to be redirected

hope this helps you.

__________________

my private spice

...to be continued
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #9 (permalink)  
Old 06-18-2007, 03:20 PM
Junior Member
Latest Blog:
None

 
Join Date: 06-17-07
Posts: 6
iTrader: 0 / 0%
bomy is liked by many
Thanks for the code. It looks like it is for a single page. Does this go at the top of the html pages? I only have access to the html frame, home, category, product pages etc. This is an ecommerce template style platform.

Will this redirect the host pages

http://www.myname.host name.com

to http://www.myname.com?

Will the www.myname.com pages be affected?

Sorry for so many questions?

Thanks

Bomy
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #10 (permalink)  
Old 06-18-2007, 03:22 PM
Junior Member
Latest Blog:
None

 
Join Date: 06-17-07
Posts: 6
iTrader: 0 / 0%
bomy is liked by many
I also have access of course to the root directory and css file. We just can get into the asp pages.

Thanks
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #11 (permalink)  
Old 06-19-2007, 02:05 AM
Costin Trifan's Avatar
Coding Tiger
 
Join Date: 04-13-07
Location: Romania
Posts: 3,308
iTrader: 0 / 0%
Costin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest order
Send a message via Yahoo to Costin Trifan
Quote:
Thanks for the code. It looks like it is for a single page. Does this go at the top of the html pages? I only have access to the html frame, home, category, product pages etc. This is an ecommerce template style platform.

Will this redirect the host pages

http://www.myname.host name.com

to http://www.myname.com?

Will the www.myname.com pages be affected?
1. I don't know what you mean here ( at the top of html pages )

2. Add this code to your index page from the http://www.myname.host name.com:
Code:
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) MyBase.OnLoad(e) Response.Status = "301 Moved Permanently" Response.AddHeader("Location", "http://www.myname.com/") Response.End() End Sub
This way the user will be redirected to http://www.myname.com every time he/she access the index page from http://www.myname.host name.com.
Digg this Post!Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mod Rewrite Help...please DM_Web _Directory Coding Forum 16 04-11-2007 06:43 PM
How to do rewrite like v7n Antonio Coding Forum 3 04-01-2006 03:19 AM
need help with mod rewrite url rewrite sim Coding Forum 3 07-31-2005 06:51 PM
Mod Rewrite T-Kai Coding Forum 5 08-24-2004 10:42 PM
php rewrite? LazyJim Coding Forum 8 04-01-2004 02:37 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 01:41 PM.
© Copyright 2010 V7 Inc
Powered by vBulletin
Copyright © 2000-2010 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.