Web Hosting Talk







View Full Version : Domain Registrars & URL 'gripping'


Crooner
10-27-2001, 07:07 AM
Can anyone tell me what software I need to do URL "gripping"?

On my DNS server the domains I have forwarded to other places show the destination address in the browser. There is supposedly something called 'gripping' that allows the original URL to show.

Thanks,
Dean

Chicken
10-27-2001, 11:45 PM
I've never heard the term 'gripping' but generally this is a rewrite issue with apache. A simple line in the virtual host directive should take care of it, though it depends on exactly what platform and flavor of linux you are using (at least I think, as I've gotten it to work with some servers, not been able to with other, but I attibute that to me, not the server).

Crooner
10-28-2001, 06:03 AM
Thanks for the reply - I'm using RedHat Linux on the server and I've been using Redirect inside the <virtualhost> section of httpd.conf. Basically just

Redirect / http://pages.zdnet.com/oldsite

Are there any other parameters for Redirect to allow it to keep the new domain name showing in the URL?

I don't know much about rewrite but I have tried the following code and it doesn't seem to work. Any ideas what's wrong with it?

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.newdomain\.com [NC]
RewriteCond %(HTTP_HOST} ^$
RewriteRule ^/(.*) http://pages.zdnet.com/oldsite/$1 [L,R]

Chicken
10-28-2001, 12:10 PM
Personally I don't but you are on the right track. What confused me is that there seems to be a few very similar code examples and I never figured out which one worked (and more importantly why or why not).

Crooner
11-01-2001, 05:31 PM
Well, I've tried just about every combination of parameters I can think of and it still doesn't work.

Any idea where else I could turn for help?

Maybe you could post the parameters that you've used in the past?

Thanks,
Dean

Chicken
11-01-2001, 11:08 PM
This is the only one I ever got to work on one server, on another it didn't work and I don't know enough about the %$^*^*%&% to get it right...


RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ http://www.domain.com/$1 [P]

ShellBounder
11-01-2001, 11:53 PM
There is some food for thought. Ahh, the power of regexps. Let me break this down a little.

RewriteEngine On

This line turns the mod_rewrite processing engine on. Your code won't work without it.

RewriteCond %{HTTP_HOST} !olddomain\.com$ [NC]

Put your main domain name here. This is one preventative thing to keep this code out of an endless loop. It can probably be left out, but I keep it in there as a precaution. It checks ths following: If the HTTP Host is NOT your old domain name, continue, and don't worry about case sensitivity.

RewriteCond %{HTTP_HOST} newdomain\.com$ [NC]

Put your domain pointer here. This keeps this seperate from everything else, and naturally, Apache needs to know what this is.

RewriteCond %{REQUEST_URI} !^/subdir

The only purpose of this line is to keep the script out of an endless loop. If you are here and all of the above criteria have been met, you've already been rewritten. If the Request URI doesn't begin with /subdir, continue. This is case sensitive.

RewriteRule ^(.*) /subdir/$1 [L]

The finale...Rewrites the full URI to the new path, and the [L] flag doesn't refresh the domain name. You can make it refresh, if you wanted to, by changing the [L] to a [R]. Finally, here's the full code:

RewriteEngine On
RewriteCond %{HTTP_HOST} !olddomain\.com$ [NC]
RewriteCond %{HTTP_HOST} newdomain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/subdir
RewriteRule ^(.*) /subdir/$1 [L]