How do I redirect the users who want to visit my site to a PHP page that has a link to index.php?
When someone go to example.com they should see a PHP page (e.g. a welcome page) where they would find a link to access the front page.
Modules
You could accomplish this with the Rules module and add granular control over who sees the splash page and when.
Additional Details
Create a new rule. (admin/config/workflow/rules/reaction/add)
React on Event: Drupal is initializing
Condition: Execute Custom PHP Code
$homepage = FALSE;
if (drupal_is_front_page()) {
$homepage = TRUE;
}
return $homepage;
Action: Page Redirect
Drupal Rules Exported Rule
This can be copy and pasted into the Rules Import menu. (admin/config/workflow/rules/reaction/import)
{ "rules_show_splash_page" : {
"LABEL" : "Show Splash Page",
"PLUGIN" : "reaction rule",
"TAGS" : [ "splashpage" ],
"REQUIRES" : [ "php", "rules" ],
"ON" : [ "init" ],
"IF" : [
{ "php_eval" : { "code" : "$homepage = FALSE;\r\nif (drupal_is_front_page()) {\r\n $homepage = TRUE;\r\n}\r\nreturn $homepage;" } }
],
"DO" : [ { "redirect" : { "url" : "splash-page-url" } } ]
}
}
Tested and working on my dev site.
If you're happy to go down the module route, the following should get you started.
You're going to want to set a cookie to see if the user has been to the site before. If the cookie is set, then you know the user has been to your site ebfore and it shouldn't redirect to the splash page.
function MYMODULE_init() {
if (!isset($_COOKIE['mysite_firstvisit'])) {
drupal_goto('path/to/splash/page');
setcookie('mysite_firstvisit', '1');
}
}
This project is in alpha, but the Splashify project may be what you're looking for.
I think you're talking about a Splash Screen (or "splash page").
I only know of one module that has such functionality for Drupal 7 (there was the Splash module for Drupal 6 but it hasn't been ported), and that's ThemeKey. One of the features that you can apparently "easily achieve" is:
a front-page / "splash" screen
I added a page--front.tpl.php in my theme. Drupal picks that up as a splash screen.