Forum Moderators: open

Message Too Old, No Replies

More 301 News/Problems

need to get a redirect up, but there is no actual site to redirect from...

         

RockLobstaar

10:14 pm on Nov 24, 2002 (gmt 0)

10+ Year Member



This is in relation to another post i had made about getting my site to redirect (http://www.webmasterworld.com/forum5/1598.htm).
My original problem was something along the lines of: google refers to the wrong URL of the site on its search results...using an older address that is no longer the correct address, thus listing us twice and giving out a "wrong" address at the top of the search results).
I wanted to do a 301 redirect (which was the advice i had gotten here), however, apparently the url www.myoldsite.com is not actually a site: just a DNS server entry that points to the IP of www.mynewsite.com.
My question for you guys is: is it worth it to set up a new site (actually several, b/c we have several pointing URLs) in order to get the redirection to show the correct "www.mynewsite.com" address? Or is there any other way of doing this? we are running NT/IIS if that means anything this time around. :)

jdMorgan

10:25 pm on Nov 24, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RockLobstaar,

No, there is no need to do this. Both of your domains will lead to your current server. On your server, you check to see if the incoming request is not for the current/correct domain name. If not, you 301-redirect to the new domain name - which actually results in another access to your same server, but this time with the correct domain name.

It's counterintuitive, but it works. Here's the code I have used:


RewriteCond %{HTTP_HOST} !^www\.mynewdomain\.com
RewriteCond %{HTTP_HOST} !^123\.45\.67\.89
RewriteRule ^(.*)$ http://www.mynewdomain.com/$1 [R=permanent,L]

Also include your server IP address to allow you access in the event of DNS failure.

This is also useful if you have registered multiple tld's and pointed them to your server, but only wish to promote one of them. If a request for mydomain.org or mydomain.net is received, it redirects to mydomain.com.

Jim

RockLobstaar

10:48 pm on Nov 24, 2002 (gmt 0)

10+ Year Member



before i start: how do i make little box quotes?
and: i'm a total infant at all of this. basically my job went from assistant manager at an indie music store to seo//webguy in a few months time b/c i am quick and have some computer/internet knowledge. so, well, i'm slow, and i apologize for reasking a ton of questions :)

now:

>>Both of your domains will lead to your current server

I follow that :)

>>On your server, you check to see if the incoming request is not for the current/correct domain name.

The incoming request will be for www.myoldsite.com: however, the DNS entry is (apparently) simply a direction toward the IP of www.mynewsite.com using the domain name of www.myoldsite.com. (is this correct understanding as to what is happening when someone clicks on the link?)

>>If not, you 301-redirect to the new domain name - which actually results in another access to your same server, but this time with the correct domain name.

So..we code it so that when the server recognizes it as coming from a request for www.myoldsite.com the server simply redirects it to www.mynewsite.com (the same server).
So..
If
Request is from name www.myoldsite.com
Then redirect request to www.mynewsite.com
?
Where would we make this code change? the webhost guy has been short with me lately and i want to give him specifics...hell, i'd love to just do it myself, but :( unfortunately i don't have that capability yet...however, i love this stuff so much i'm thinking of dropping my anthro/religious studies major and getting into webmastering...
Sorry for being dense ;-)
And thanks so much for your patience :D

Rocky

jdMorgan

11:25 pm on Nov 24, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RockLobstaar,

The code I supplied will fix your problem as it is. Unfortunately, it's for use in the .htaccess file on an Apache server. We'll have to wait for someone to come along to tell you how to do it on IIS. Or you might want to try a WebmasterWorld site search and look for redirection subjects on IIS server.

To make a quote box, either use the "reply with quote" checkbox below, or surround your quote with [.quote]quoted text[./quote] but leave out the two periods.

Jim

RossWal

9:01 pm on Nov 26, 2002 (gmt 0)

10+ Year Member



Rocklobstaar,
On IIS, you will probably need to write a bit of ASP code. Here are a few things to get you started.

Request.Servervariables("SERVER_NAME"): Provides the domain name used to access the site. (pretty sure, going on memory)

Response.Redirect("http://somewhere.com"): sends a message to the browser to redirect to the new URL

Response.Write("<h1>I am the King of all Widgets</h1>"): allows you to write stuff to be displayed as html on the users' screen

Response.write(Request.Servervariables("SERVER_NAME")): inserts the domain name into the html for your testing purposes.

ps your asp code needs to be inserted into brackets like this <% put your code here %>