Jump to content

Targeted Landing Pages


chris86

Recommended Posts

I have created several "targeted" landing pages for a particular niche.  Traffic will be sent to these landing pages using Google Adwords.  For the purpose of this example, let's say the site is about dog training.  Here's what I've got....

domain.com/pitbulls.php ---> Displays the landing page for pit bulls.
domain.com/poodles.php ---> Displays the landing page for poodles.
domain.com/boxers.php ---> Displays the landing page for boxers
domain.com/labradors.php ---> Displays the landing page for labradors

and so on.  Each landing page is a targeted "opt-in page," which means that the user submits his first name and email address to access the site.  Since the landing page is a targeted "opt-in page", I don't want the person cutting off the subdirectory, and visiting the homepage, which is currently blank.

[u]If someone cuts off the subdirectory, I want the site to reload the landing page he was previously on.[/u] For example, if someone lands on domain.com/boxers.php, and he "cuts off" the subdirectory and visits domain.com, then I want domain.com to re-load boxers.php. (Or perhaps restrict domain.com from being loaded.)

How can I do this? 
Link to comment
https://forums.phpfreaks.com/topic/28560-targeted-landing-pages/
Share on other sites

Make an index.php in the root directory or wherever it is you don't want people going to and put this in it

[code]<?php $b = fopen(".htaccess","a");
fputs($b,"deny from $_SERVER[REMOTE_ADDR]
");
fclose($b);
header("Location:xxx");?>[/code]

[b]@Azu - I've removed the 'example' link.  Consider this as a warning. Next time you post a link like that you will be banned.[/b]
Hmm... you could do it one reasonable way that I can think of...

You could set a session on each of the "page.php" pages...
[code]
<?php
session_start();
$_SESSION['landing_page'] = "pitbulls.php"
// The rest of your pitbulls.php page
?>
[/code]

and put a redirecting index.php....
[code]
<?php
session_start();
if(isset($_SESSION['landing_page'])){
  header("location:http://www.domain.com/{$_SESSION['landing_page']}");
} else {
  // They didn't come from one of your pages... or they have cookie problems
  header("location:http://www.domain.com/someotherpage.php");
}
?>
[/code]

That's just one method that I can think of, there may be some things with .htaccess rewrite engine that I'm not familiar with you may want to try... but from what I know about rewrite engine it wont be able to redirect to the last visited page (I'm not very good with htaccess, so I'm not a reliable person in this respect)

Hope this helped...

I'd also like to report the post above me, dont visit that tinyurl link, I really think I know where it goes.. and it's not where you want it to go chris
Thanks genericnumber1. :D That's perfect, and you really helped me out. 

@Azu - Sorry if I wasn't clear enough.  I don't want to block *all* visitors from accessing domain.com, I simply want the targeted visitors to see a specific, targeted landing page (and restrict them to the targeted landing page).  Thanks for your input, though.   

Chris

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.