chris86 Posted November 26, 2006 Share Posted November 26, 2006 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 boxersdomain.com/labradors.php ---> Displays the landing page for labradorsand 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 More sharing options...
Azu Posted November 26, 2006 Share Posted November 26, 2006 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] Link to comment https://forums.phpfreaks.com/topic/28560-targeted-landing-pages/#findComment-130665 Share on other sites More sharing options...
genericnumber1 Posted November 26, 2006 Share Posted November 26, 2006 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]<?phpsession_start();$_SESSION['landing_page'] = "pitbulls.php"// The rest of your pitbulls.php page?>[/code]and put a redirecting index.php....[code]<?phpsession_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 Link to comment https://forums.phpfreaks.com/topic/28560-targeted-landing-pages/#findComment-130669 Share on other sites More sharing options...
Azu Posted November 26, 2006 Share Posted November 26, 2006 No you aren't supposed to go there, it's for the pesky people that go into the domain you don't want them in :P Link to comment https://forums.phpfreaks.com/topic/28560-targeted-landing-pages/#findComment-130670 Share on other sites More sharing options...
genericnumber1 Posted November 26, 2006 Share Posted November 26, 2006 yes, but he wanted it to redirect to the last page visited...and why would you block someone from your site in your .htaccess just because they got curious and cut off a filename in the URL? Link to comment https://forums.phpfreaks.com/topic/28560-targeted-landing-pages/#findComment-130673 Share on other sites More sharing options...
chris86 Posted November 26, 2006 Author Share Posted November 26, 2006 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 Link to comment https://forums.phpfreaks.com/topic/28560-targeted-landing-pages/#findComment-130704 Share on other sites More sharing options...
mainewoods Posted November 27, 2006 Share Posted November 27, 2006 you could create an index.htm page and put this in it:[code]<body onload="window.history.back(-1);">[/code] Link to comment https://forums.phpfreaks.com/topic/28560-targeted-landing-pages/#findComment-130793 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.