Page 1 of 1

mod_rewrite - redirecting without changing the URL

Posted: Tue Aug 29, 2006 8:28 am
by nutkenz
I'm really not sure if this is possible; what I want is to redirect people who visit http://www.source.tld like this;

RewriteEngine on
RewriteRule ^(.*)$ http://www.destination.tld/splash.php$1 [R=301]

But the flaw with this rule is that the URL is also changed. Is it possible to redirect a user without changing the URL and without using a 100% sized frame?

I don't want to use a frame because the splash.php page is supposed to get the referrer etc and store these in a DB. There are a lot of source domains and I don't want to upload a hundred files when anything changes.

Posted: Tue Aug 29, 2006 8:49 am
by feyd
Direct them to a script on your server which performs the remote request for them. The problem is you must get the other site's permission, in writing, to pull their information and display it as your own.

Posted: Tue Aug 29, 2006 9:46 am
by nutkenz
That seems like an overly complicated solution. Both sites are mine by the way.

Posted: Thu Aug 31, 2006 2:29 am
by alex.barylski
Use AJAX to rip content from one and inject into the other...

This cancels any back forward browsing though...I think you can use the hash mark # followed by a unique number though to work around that if needed...

This also will only work in javascript enabled browsers...

HTH

Posted: Thu Aug 31, 2006 6:45 am
by nutkenz
Ok, why doesn't the following work?

RewriteEngine on
RewriteCond %{REMOTE_ADDR} !(^87\.244\.[0-2][0-9][0-9]\.[0-2][0-9][0-9]$) [NC]
RewriteRule ^(.*)$ http://www.url.tld/splash.php$1 [R=301,L]

The plan is to NOT redirect anyone in the specified IP range to the splash page...

I checked the Regex using the Regex Coach so that shouldn't be the problem.