Dynadot โ€” .com Registration $8.99

Htaccess help needed

Spaceship Spaceship
Watch

ZuraX

Established Member
Impact
42
Hoping someone here can help..

Right now I have a htaccess redirecting all my parked domains to one of my domains.
I would like to have it redirect them to http://www.some3rdparty.com/mydomain.com but have no idea how to get htaccess to input the domain.com part depending on which domain the user has went to.

EX: They goto http://www.123domain.com they get sent to http://www.some3rdparty.com/123domain.com
If they goto http://www.456domain.com they get sent to http://www.some3rdparty.com/456domain.com

Thanks for any help.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
0
•••
Yeah I have seen that one. It doesnt tell me how to get "mydomain.com"...
 
0
•••
Ok just threw this one toghether, let me know if it works,

PHP:
<?php
$domain=$_GET['domain'];

 header("Location: http://www.some3rdpary.com/$domain ");

?>

Just save it as go.php or whatever and when someone goes to go.php?domain=something.com then it directs them to 3rd party site, you can use mod rewrite to make it yoursite.com/whatever and use this same script

Thanks.
 
0
•••
If you want .htaccess
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.(.*)$
RewriteRule ^(.*)$ http://%1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www.(.*)$
RewriteRule ^(.*)$ http://www.google.com/%{HTTP_HOST} [R=301,L]
Change "google" to the domain you want to redirect to. I briefly tested it and it works OK.

 
0
•••
StackedTech said:
Ok just threw this one toghether, let me know if it works,

PHP:
<?php
$domain=$_GET['domain'];

 header("Location: http://www.some3rdpary.com/$domain ");

?>

Just save it as go.php or whatever and when someone goes to go.php?domain=something.com then it directs them to 3rd party site, you can use mod rewrite to make it yoursite.com/whatever and use this same script

Thanks.

Yeah may have to use that. Just wonderign what Google and the others will do if I did...

B33R said:
If you want .htaccess
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.(.*)$
RewriteRule ^(.*)$ http://%1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www.(.*)$
RewriteRule ^(.*)$ http://www.google.com/%{HTTP_HOST} [R=301,L]
Change "google" to the domain you want to redirect to. I briefly tested it and it works OK.


Will that remove the www. part?
What if they goto say www.mydomain.com/bahbah? WIll it send them to http://www.some3rdpary.com/mydomain.com or http://www.some3rdpary.com/mydomain.com/bahbah?
 
0
•••
First two lines (after RewriteEngine on) remove the www. part of the domain, second pair of lines redirect http://mydomain.com to http://www.some3rdparty.com/mydomain.com

If you go to www.mydomain.com/whatever.php it'll remove the www. and everything after and including the /
so you'll get sent to http://www.some3rdparty.com/mydomain.com every time.
 
0
•••
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back