Topic: asp redirect domain problems. (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=27658" title="Pages that link to Topic: asp redirect domain problems. (Page 1 of 1)" rel="nofollow" >Topic: asp redirect domain problems. <span class="small">(Page 1 of 1)</span>\

 
Gilbert Nolander
Maniac (V) Inmate

From: Washington DC
Insane since: May 2002

posted posted 03-19-2006 05:11

Hello,
I'm sure this is something simple...but sometimes posting in here gives me time to reflect, and plus it has been a while...

Anyway, I own two domain names now on the same server, both currently pointing to the file www.jeff-nolan.com/index.html ... the domains are www.jeff-nolan.com and www.woolenwhimsy.com

I am having a problem with woolen whimsy. I am trying to use some asp code so that when the user goes to the page www.woolenwhimsy.com they will be redirected to www.jeff-nolan.com/woolenwhimsy/index.html

here is the asp code, which I put in the file called default.asp

code:
<html>
	<body>
		<%@Language=VBScript%>
		<%
		SiteNameURL = Request.ServerVariables("SERVER_NAME")
			Select Case SiteNameURL
				Case "woolenwhimsy.com"
					Response.Redirect "woolenwhimsy/index.html"

				Case "www.woolenwhimsy.com"
					Response.Redirect "woolenwhimsy/index.html"

				Case Else
					Response.Redirect "index.html"
			End Select
		%>
	</body>
</html>




thanks,
jeff

----| Asylum Quotes

(Edited by Gilbert Nolander on 03-19-2006 06:18)

Gilbert Nolander
Maniac (V) Inmate

From: Washington DC
Insane since: May 2002

posted posted 03-19-2006 06:22

I even tried this.

code:
<html>
	<body>
		<%@Language=VBScript%>
		<%
		SiteNameURL = Request.ServerVariables("SERVER_NAME")
			Select Case SiteNameURL
				Case "woolenwhimsy.com"
					Response.Redirect "http://jeff-nolan.com/woolenwhimsy/index.html"

				Case "www.woolenwhimsy.com"
					Response.Redirect "http://jeff-nolan.com/woolenwhimsy/index.html"

				Case Else
					Response.Redirect "http://jeff-nolan.com/Index.html"
			End Select
		%>
	</body>
</html>

Gilbert Nolander
Maniac (V) Inmate

From: Washington DC
Insane since: May 2002

posted posted 03-19-2006 20:06

I have a javascript running now called woolenwhimsy.js that is temporarily fixing and is loaded from index.html, but I don't really want to use it, unless I have to.

jeff

----| Asylum Quotes

Gilbert Nolander
Maniac (V) Inmate

From: Washington DC
Insane since: May 2002

posted posted 03-19-2006 20:06

also, here is a link that talks about what I am trying to do...

http://kb.brinkster.com/kb.asp?kb=108075

hyperbole
Paranoid (IV) Inmate

From: Madison, Indiana, USA
Insane since: Aug 2000

posted posted 03-20-2006 19:32

Why don't you just use mod_rewrite?

.



-- not necessarily stoned... just beautiful.

Gilbert Nolander
Maniac (V) Inmate

From: Washington DC
Insane since: May 2002

posted posted 03-21-2006 04:39

you make it sound so simple.



I'm not a professional webpage creator or anything. I just do this in my spare time, and wanted to throw something quick together. First off, I don't even know if Brinkster uses Apache Servers, and actually I'm a bit confused as to if this even matters, second. This stuff is all new to me, as I barely understand css, yet alone asp or mod_rewrite. And I have no idea, even after briefly reading through some stuff, how I would ever get this to work. For now, I will stick with the javascript, and not worry about what shows up in the url bar, unless this is something simple for you, and you could explain it really easy and simple...like you were to a six, or rather...make that three, year old...

let me clarify.

quote:
Apache Website - This module uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested URLs on the fly.



This is the first line from apache's site dealing with mod_rewrite. To me this sentence could be in another language. I do not know what it means by module, I also have no idea what a rule-based rewriting engine or a regular-expression parser is. So, for me to try and figure this out, would take a lot of work, you see...

thanks...

(Edited by Gilbert Nolander on 03-21-2006 04:40)

(Edited by Gilbert Nolander on 03-21-2006 04:52)

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 03-21-2006 13:00

are you wanting the URL to stay www.woolenwhimsy.com and have the content come from http://jeff-nolan.com/woolenwhimsy/index.html ?

if you just want it to redirect, how about just using a meta tag?

code:
<meta http-equiv="refresh" content="0; URL=http://jeff-nolan.com/woolenwhimsy/index.html" />



Later,

C:\

Gilbert Nolander
Maniac (V) Inmate

From: Washington DC
Insane since: May 2002

posted posted 03-21-2006 13:35

This is correct CPrompt. I want the URL to stay www.woolenwhimsy.com and have the content come from http://jeff-nolan.com/woolenwhimsy/index.html. I can't use a redirect, because if you go to woolenwhimsy.com it points to the file jeff-nolan.com/index.html by default. Since both domains are under the same webroot.

hyperbole
Paranoid (IV) Inmate

From: Madison, Indiana, USA
Insane since: Aug 2000

posted posted 03-21-2006 18:11

Gilbert Nolander:

I understand what you mean when you say "To me this sentence could be in another language." I run in to that a lot and I've been working with computers for thirty-five years. Every time I try to understand a new technology or even have a discussion about existing technology, it's like learning a new language.

To answer some of your questions:

The Apache web server allows you to modify its behavior by adding modules to it. You can think of a module kind of like a Plug-In or an external library. It is just a complete (black box) entity that you can add to Apache to modify or add to it's core behavior. BTW you don't have add the module to Apache, your web host will do that or not as they see fit. If they have already added the mod_rewrite module, then you can create a .htaccess file to modify the standard behavior of Apache.

Rule based means that you provide rules in your .htaccess file that tell the mod_rewrite module how to behave. Each rule starts with a rule name such as RewriteEngine, RewriteCond, RewriteRule, RewriteMatch, etc. You can then provide values to tell mod_rewrite what to do. For example, you need a rule that says 'RewriteEngine On' to ensure that mod_rewrite will use your redirect commands.

The part of mod_rewrite that reads and executes your .htaccess file is called the RewriteEngine. This is really just another term to refer to mod_rewrite.

A regular expression is a way to specify a pattern. It is used to look for patterns in strings. For example, if I have a file that has the name 'Gilbert' in it somewhere, I can run a program that interprets regular expressions and tell it to print each line that contains the pattern 'Gilbert'.

The pattern Gilbert is the simplest kind of regular expression because each character in the pattern matches exactly that pattern in the searched file.

Regular expressions are very powerful and can be used to find many different kinds of patterns, For example, I can find all words that start with an uppercase letter followed by one or more lowercase letters with the pattern '[A-Z][a-z]+'. You shouldn't need any patterns more complicated than that.

I think that IIS also allows you to use a .htaccess file, but you would need to check on that if you are on an IIS server.

I think the following would allow you to do what you want. Just put it into a file called .htaccess, upload the .htaccess file to the root directory of your web pages and test it. It should go in the same directory with the index.html file that you see when you type http://www.jeff-nolan.com/index.html in the address bar of your browser.

code:
RewriteEngine On
RewriteCond %{HTTP_HOST} (ww+\.)?woolenwhimsy.com
RewriteCond %{REQUEST_URI} !/woolenwhimsy/
RewriteRule (.*) /woolenwhimsy/$1



Make sure to upload this as a plain ASCII file. Tell your FTP program that the file is ASCII so it will translate the end of line characters as it transfers the file.

The line 'RewriteEngine On' makes sure that mod_rewrite is processing your URIs.

'RewriteCond %{HTTP_HOST} (ww+\.)?.woolenwhimsy.com' says to only process the following lines when the HOST part of the URI contains 'woolenwhimsy.com', with or without a leading 'www.'. Note: the part of the line after %{HTTP_HOST} is a regular expression. 'ww+' looks for two or more 'w's in a row follows by a '.'. The '?' says that the entire expression in parentheses is optional.

'RewriteCond %{REQUEST_URI} !/woolenwhimsy/' says to not process the line if it already contains the directory /woolenwhimsy/, This is a simple regular expression with a 'not' (!) symbol in front of it. If it matches the string '/woolenwhimsy/' it fails.

'RewriteRule (.*) /woolenwhimsy/$1' says to process any line that matches the above conditions by prepending '/woolenwhimsy/' to whatever the line already contains. Note: (.*) is another regular expression with matches all characters in the line. The RewriteRule only matches the REQUEST_URI part of the URI and will automatically prepend the HTTP_HOST to the resulting URI (unless you specify an external reference, which we won't get into here).

For example, If you enter 'http://www.woolenwhimsy.com/page1.html' in the address bar of your web browser, when the request gets to your host machine, the web server will pass the URI to mod_rewrite. mod_rewrite will compare the URI to the first RewriteCond. The URI matches because it does contain 'www.woolenwhimsey.com' in the %{HTTP_HOST} part of the URI.

It then checks to see if the %{REQUEST_URI} contains the directory name '/woolenwhimsy/'. Since it does not, the URI passes this test.

Now mod_rewrite executes the RewriteCond statement. It matches every thing in the %{REQUEST_URI}, i.e, 'page1.html', and appends it to '/woolenwhimsy/'. This gives you a URI of 'http://www.woolenwhimsey.com/woolenwhimsey/page1.html'.

Since this is the last line in .htaccess, the rewrite engine now passes this new URI back to the start of processing and runs the URI through the same process again.

It checks the %{HTTP_HOST} to see if it contains www.woolenwhimsey.com. It does so it checks to see if the %{REQUEST_URI} contains /woolenwhimsy/. Since it does, this RewriteCond fails and the URI is passed, as is, back to the server which completes the request.

If you have a file called 'page1.html' in the directory '/woolenwhimsy/' on your server, the server will pass it back to the client machine. Otherwise, it will generate a 404 message.

Since this is a local redirect, the content of the address bar on your browser should not change. If it had been an external redirect, the server would have notified the browser and it would have changed the address bar.

I hope that helps. Try out this file and let us know if it works. Also if you find this confusing or unclear, please ask more questions.

.



-- not necessarily stoned... just beautiful.

Gilbert Nolander
Maniac (V) Inmate

From: Washington DC
Insane since: May 2002

posted posted 03-21-2006 21:07

Crap. Brinkster does not allow .htaccess
It is a windows server, and not Apache so it does not work. I guess I have to figure out how to get the asp thing to work.

thanks so much though for the explanation, I'm sure somewhere down the road it will help me, or someone else..

(Edited by Gilbert Nolander on 03-21-2006 21:09)

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 03-22-2006 01:35
quote:

Gilbert Nolander said:

Crap. Brinkster does not allow .htaccess It is a windows server, and not Apache so it does not work.





I'd get a different host after your contract ran out

Later,

C:\

Gilbert Nolander
Maniac (V) Inmate

From: Washington DC
Insane since: May 2002

posted posted 03-23-2006 05:39

yea... maybe so.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu