Forum Moderators: coopster

Message Too Old, No Replies

one-time splash pages, deeplink behaviour and http referer .

Is this even achievable without .htaccess?

         

christopherwoods

6:38 pm on Dec 14, 2009 (gmt 0)

10+ Year Member



I've been thinking about this functionality for a while, but (no matter how hard I trawl the interwebs, nor how hard I try and build the code on my own) I can't quite crack it using just pure PHP.

Here's an explanation of what I'm trying to make work:

A site has a splash page (e.g. welcome.php), which overrides the default /index.php (doesn't have to be specified) when a visitor first visits. Clicking on from the splash page to / then shows index.php.

Clicking on other pages, or the frontpage link, once on the web site (using http_referer) shows the pages as expected.

However, bypassing this behaviour, if a user clicks on a deeplink (from Google or another site) the content is displayed immediately and the splash page isn't shown.

I've begun to think it's only simply doable if you combine checks using REQUEST_URI to check for stuff after "example.com/" with http_referer for checking on-site vs. off-site clicks to further pages.

I've been experimenting with trying to make this work on a WordPress site (using the splash for a Christmas-related welcome image) and I can get as far as the splash page displaying on a first visit and on-site clicks working as expected. However, I can't figure out the next step required - to preserve the deeplink behaviour.

Ideally I'd like to be able to come up with a way to do this just using regex functions in PHP if/else code - .htaccess seems a bit messy by comparison if you can just get a chunk of PHP to just drop in/out. That said, if it's easier to do using .htaccess with regex... ;)

Am I even going about this the right way?

rocknbil

8:56 pm on Dec 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Am I even going about this the right way?

Since your scheme includes a "splash" or "entry" page, the answer is absolutely no, you're wasting not only your time on this but the visitor's time. Take 'em right to the main page!

As for entering via deep links, think a moment about the statement here [webpagesthatsuck.com]:

As the donor starts to sign the lucrative, long-term pledge, you reach over across the table, grab the donor by the throat, and yell "Not so fast, jerkface! I haven't finished my pitch!"

You wouldn't do that, would you? Then why are you using design techniques that keep the visitor from getting to the sale?...."Don't do anything that gets in the way of the sale."

This is in effect what you're doing with trying to force the visitor's entry to your site - trying to get it to do what you want, not what they want.

Sure, you could have a global include for all pages to do this, but telling you how is not "good advice." It's just enabling you to shoot yourself in the foot. :-)

topr8

9:14 pm on Dec 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



not sure what you are trying to do...
are you trying to get the first visit to the 'home' page to show the splash page, but all other hits (eg to inside pages, or further hits to the home page) to just show the regular page that it should be?

do you want google to index your splash page as your home page?

remember not all browsers return the referer-header.

have you thought about showing your xmas image in a div which is hidden if a cookie is set for instance, but otherwise it is absolutely positioned over the page?

christopherwoods

1:31 am on Dec 15, 2009 (gmt 0)

10+ Year Member



@rocknbil - absolutely agree, I hate permanent splash pages! However, as a temporary Christmas promotion (which is removed on Boxing Day) it serves its purpose and is what I'm specifically trying to achieve.

@topr8 - here's the workflow:

new visit to example.com: splash page
new visit to example.com via deeplink to (e.g.) example.com/content/one/: regular content shows
clicks to other pages (including example.com/) after loading a page on example.com: regular content is shown

Hopefully I've explained it a little more clearly this time :)

christopherwoods

1:33 am on Dec 15, 2009 (gmt 0)

10+ Year Member



Also, showing the splash page could be done just once via setting of a cookie (and the main site's menu still shows along the top of the page).

It's the optimal way to promote this particular Christmas promotion to every visitor, and as the design differs from the rest of the site's pages it's necessary to use a splash page. Not the most ideal of things (and I always tell people to avoid splash pages at all costs, so I know how ironic this all is) but it serves its purpose for the very limited scope of the Christmas season.