IT.COM

strategy Show Domain Redirects in URL with 1 page lander for all?

Spaceship Spaceship
Watch
Impact
467
will attempt to explain it better than that, and really appreciative of any tips and ideas....

Basically, what i want to do is figure out a solution for my domain portfolio website so I can SEE in my stats exactly WHICH domain brought someone there, although it is now just a 1-page contact form landing page. I USED to really showcase all my domains and used a few different scripts and all worked fine, each domain had its own individual page with a contact form and I could just redirect each domain to its specific landing page url, and of course that would be clear in my statcounter results which domain was visited etc.

But, I decided to simplify things and save myself the time and trouble constantly adding domains to my portfolio script, forwarding them to the specific pages and then removing things or marking as sold when no longer available etc. So, I decided to move to a 1-page lander with a contact form and just redirect all domains there. BUT, of course that means that now I no longer know which domain brought the person there which is a bummer.

So, what I want to figure out is how to forward or redirect my domains to the 1-page site and yet see which domain brought them there. If this is something I can do with a particular htaccess snippet that would be awesome. If it matters, my portfolio domain has its own IP address, but forwards to general wiredtree nameservers. I had thought about just forwarding all domains to its nameserver but since it doesn't have its own that wouldn't work as far as i know.

To illustrate, here is what I want, or at least how I imagine it working:

I forward all domains like now but add /domainexample1, domainexample2 etc for the domain forwards.
So when someone types domainexample1.biz in the url they are redirected to mydomainportfolio.xyz/domainexample1, which shows the same lander as on mydomainporftolio.xyz, but I am able to see that domainexample1.biz is what brought them there..... does that make sense?

Thanks in advance for any tips. If there is a different/better way to go about it that is great, just want to keep it simple as possible.
 
1
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
1
•••
thanks for that..... but i am not sure it applies. In my case there actually is NOT any page (on the server or even within a wordpress dashboard) that is being forwarded to (I am familiar with forwarding domains, including to a specific url or subdomain or folder). And although the solutions were interesting, each solution seemed to entail specifying each and every mainsite/domainexample there could be (ie updated as i buy domains)..... which would be pretty timeconsuming maintaining like the original system.

i appreciate the time and suggestion and will keep it in mind as a possibility to modify if no other idears come in.
 
1
•••
I would not use WP for one-page site. Instead, I would create one-page index.php, then using .htaccess will get 'camefrom' value of fake .html pages for each domain and write it somewere.

.htaccess:
RewriteEngine on
RewriteRule ^(.*)\.html$ index.php?camefrom=$1 [nc]

index.php:
if (isset($_GET['camefrom']))
$camefrom = $_GET['camefrom'];
$mysqli = new mysqli("localhost","dbuser","dbpass", "dbtable");
if (!$mysqli->connect_errno)
$query = "insert into `tablename` values (".$camefrom.")";
 
0
•••
That's more like it thanks! Sorry, thought I had been clear in first post it IS only a 1 page lander, not using wp.

This solution is very interesting and thought out... however I am not really looking to store the sending domains data in a dB , just Want to see the visited URL via stat counter....
 
0
•••
Then use only .htaccess code. And put Statcouner code on index.php. It works for me - say site is aaaaaa.com and you visit any virtual page like aaaaaa.com/111.html, aaaaaa.com/222.html - Statcounter shows visits as aaaaaa.com/111.html and aaaaaa.com/222.html
 
1
•••
If I understand correctly...

On domain A page have a code.."if interested in buying, please include code ( to show you are not a bot)" before link to landing page...


On domain B page have a different code.."if interested in buying, please include code ( to show you are not a bot)" before link to landing page...

Etc..

On landing page, add spot to insert code...
 
1
•••
This is a suggestion I read to a similar question. It may help.

Setup the DNS records or your host probs allows you to park on top of another domains and then you would add something like

<?php
$host = $_SERVER['HTTP_HOST'];
$host1 = str_replace("mydomain.co.uk", "mydomain.html", $host1);
$host1 = str_replace("anotherdomain.co.uk", "page2.html", $host1);
$page = $host1;
header("Location: http://$host/$page");
?>

If you have a lot of domains you would be best using a database
 
1
•••
I use Piwik.

You can see the referring sites and keywords used to find your domain's landing page.

But it also has a lot of referrer spam to deal with, which is really annoying.

I used to use Streak to see if someone opened my emails, but I stopped using it.

With Piwik I can see if someone checks out a domain that I emailed them about.

I can also see how many times they return and check out the domain's page.

It helps to see how interested they are in the domain.

I have been using Piwik for years.

Lately it has gotten much better.

You can see which domains are your most popular.

You can see lots of other info too, like what country they come from, their IP address, etc.

I have also caught people stealing my logo images.

It is similar to Google analytics, but I like it better, and only you can see the stats.

You have to have your own server to use it though.

It can be a problem to setup and it has some bugs that pop up during setup.

Sometimes when you upgrade to a new version it gets messed up and you can lose all your data.

I always make a full site and database backup before upgrading.
 
2
•••
I have experience with this 1 page solution.

I would use .htaccess in the root directory of all other domains that would forward to a URL like:

http://mysite.com/contact/DomainName

(DomainName would be without the .ext)

This URL was handled by a custom PHP page that would report the domain name used within analytics.

The trick of it is how to streamline the process of adding the redirect to every domains root directory. I simplified this by using a custom server side php solution that would read my list of domains and output a .htaccess file in each directory to properly redirect to the intended URL.

This is preferable because most registrars don't have a bulk redirect method. You just point your DNS records like normal, and you can make sweeping changes within seconds after you setup server side solutions like the one previously mentioned.
 
2
•••
I have experience with this 1 page solution.

I would use .htaccess in the root directory of all other domains that would forward to a URL like:

http://mysite.com/contact/DomainName

(DomainName would be without the .ext)

This URL was handled by a custom PHP page that would report the domain name used within analytics.

The trick of it is how to streamline the process of adding the redirect to every domains root directory. I simplified this by using a custom server side php solution that would read my list of domains and output a .htaccess file in each directory to properly redirect to the intended URL.

This is preferable because most registrars don't have a bulk redirect method. You just point your DNS records like normal, and you can make sweeping changes within seconds after you setup server side solutions like the one previously mentioned.

Biggest registrars have the bulk redirect option, though. Could you share the ones that do not support it? Thanks!
 
0
•••
Biggest registrars have the bulk redirect option, though. Could you share the ones that do not support it? Thanks!

You misunderstand.

Registrars don't have a bulk method for you to go in and edit each individual domain redirection at once.

You might be able to point them all to one URL 'in bulk', but you can't customize each domain redirection unless you do it manually.

That's why you set the DNS to your desired nameservers 'in bulk' and then you can have a process server side that can handle .htaccess creation for your portfolio; or whatever else you need.
 
Last edited:
1
•••
thanks for all the contributions here, and I hope I explained/included enough details about what I what to achieve, and what I am currently doing. To summarize and hopefully simplify again I will break it down another way:

!) my portfolio domain is a 1-page index.html located at (let's say) myportfoliodomain.xyz which has its own ip address but not its own nameservers (points to wiredtree nameservers).
2) My domains come and go, and are at various registrars, and I got tired of constantly updating my portfolio script with new domain details, which DID give each domain its own "page" which i could specifically forward each domain to. Too much work, but was nice seeing in statcounter EXACTLY which page (and thus which domain) brought someone to my site.
3) NOW all domains simply forward to myportfoliodomain.xyz .... so, all domains bring people to the 1-page contact page lander, but unless they actually contact me I have no idea which domain brought them there.
4) IF I forward a specific domain to a subfolder/page, like mydomainportfolio.xyz/demodomain1 and go to that url of course it gives me a 404 not found error.
5) What I want is to be able to forward, either with namservers, ip address or url forward, ALL domains to unique /addys and show this same default index.html lander contact page on each and EVERY possible mydomainportfolio.xyz/demodomain584 etc or basically ANYTHING after the "/" and the statcounter code would then show me the specific url that was visited.
6) So ALL domains forwarded to unique subpages, but actually only using a single, root index.html file as the content........

Does that help or am i still going in confusing circles? I was hoping that there was a easy way to do this, to treat any page on a domain as if it "existed" although it does not, and simply show a default index.html page for everything. I guess I feel a bit less dumb about it all, which is refreshing, since there wasn't a really "DUH!" solution yet that would make me blush I had to even ask lol.... thanks again to everyone that is throwing their hat in the ring!

edit: reading again, your post sounds interesting barefooted, regarding using htaccess... so you are saying there is a way to share this default index.html page on "virtual" pages that do not truly exist on the server? that sounds like what i need.... any tips on the htaccess snippit?
 
Last edited:
0
•••
.htaccess:
RewriteEngine on
RewriteRule ^(.*)\.html$ index.php?camefrom=$1 [nc]

Rename main domain index to.php.
Then, any "maindomain.com/someotherdomain.html" will show index.php content, unless you put there some logic to show different content for different "camefrom" values, for example different pagetitle, price, form value etc.

Actually, this way you are able to create whatever page extensions you want - .asp, .aaa - they are not real.
 
1
•••
thanks barefooted! i gave it a go but so far not working.... i changed index.html to index.php, modified my htaccess file and added those 2 lines (already had 1 line dealing with WWW, using the non-wwww instead).... i went to a random subpage at mydomainportfolio.xyz/dedmodomain1 but STILL get the 404 not found.

Hoping this solution will work, ideally WITHOUT the .html tacked on (ie just mydomainportfolio.xyz/demodomain1 etc....). Thanks for the work on this, hopefully helps someone else interested in doing the same as well!
 
0
•••
If you don't want to use .html

RewriteEngine On
RewriteRule ^(.*)$ index.php?camefrom=$1 [L,QSA]
 
1
•••
thanks to everyone, ESPECIALLY Barefooted, who solved the riddle for me completely using basically this (would need to adjust of course based on domain and any relevant folders etc):

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.myportfoliodomain\.xyz$ [NC]
RewriteRule ^(.*)$ http://www.myportfoliodomain.xyz/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !^/assets/.*$
RewriteRule ^(.*)$ index.php?camefrom=$1 [L,QSA]

------------------------

now, the only thing that would be even "better" is if I could just forward the domains to my main site and yet the "original" domain being forwarded would just be tacked on after the / automatically (ie saving me the trouble of manually forwarding each domain specifically to mydomainportfolio.xyz/whateverdomain at the registrars) but this is still MUCH better than what i had and am VERY grateful for the help!
 
Last edited:
2
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back