Landing page with WordPress

I was asked recently to do a landing page on a WordPress based website. I didn’t want to do some popup window that would show up when user enters website or set WordPress home page to static page. Instead, I wanted to do completely custom web page that has no connection to WordPress installation what so ever.

First thing that came to my mind was: Ok, I will just set DirectoryIndex in .htaccess file to my new landing page. But this would result in showing landing page every time somebody wanted to see home page, and that is not what I wanted.

Second solution that I was thinking of was moving entire WordPress installation to subfolder (for example, and putting index.html (landing page) in root folder. This solution would work, but it was time consuming, and eventually I would have to move whole website back once landing page is removed. So, not a good idea.

Third solution was to check referer before displaying page.
What this means?
If http referer contains home url of my website, nothing would happen. Site would just load normally.
But if user was refered from Google or some other website,  he would get the landing page.
This is done by editing themes index.php file.

Here is the code:

Quick explanation: If http_referer contains home url of wordpress blog, script would go to else branch, and it would load themes original index.php.
But if http_referer doesn’t contain home url, script includes file called index.html from folder film, and it won’t load index.php that is in else branch.

Hope someone finds this tip useful.

2 Responses

  1. Kirill 11. January 2013. / 12:48

    It’s crazy!!!! Thank’s!!!

Leave a Reply

Your email address will not be published. Required fields are marked *