Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 1, 2026.

Htaccess help needed

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
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.
GoDaddyGoDaddy
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
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back