[Web] Redirect to temporary notice on Wordpress?

Ancalagon44

Diamond Member
Feb 17, 2010
3,274
202
106
Hi guys,

Okay.. so I've been asked to create a temporary notice to show some important information on our clients, and display this notice on our home page, which is a custom Wordpress/PHP site (I didnt write it).

So, ourwebsite.com needs to go to index.html, or whatever, and that temporary notice page needs to have a link to take people to the regular Wordpress homepage. Essentially like one of those adverts, only its not an advert, its pretty important.

The Wordpress site doesnt use a static homepage, and is not a blog so it doesnt show recent posts. As far as I can tell, content in {theme folder}/library/home/loop.php is displayed as the home page. So I'm not too sure what the permanent address of the homepage is.

Any suggestions on how to do this? I have full access to the PHP source and admin access on the Wordpress admin app, so I can edit anything required.
 

GregGreen

Golden Member
Dec 5, 2000
1,688
5
81
Use .htaccess to redirect / to index.html. Then use JavaScript to redirect back to index.php.

I'm not entirely sure if you can place the index.html at root, but you can place it in a dir in the wp-content folder and use the htaccess to make it look like its at root.

OR

You can create a new page in WP that doesn't show up in your navigation and then set that to be the home page.
 
Last edited:

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Use .htaccess to redirect / to index.html. Then use JavaScript to redirect back to index.php.

I'm not entirely sure if you can place the index.html at root, but you can place it in a dir in the wp-content folder and use the htaccess to make it look like its at root.

OR

You can create a new page in WP that doesn't show up in your navigation and then set that to be the home page.

I thought about this as well, but won't that cause a problem with any links to root in the current site?
 

GregGreen

Golden Member
Dec 5, 2000
1,688
5
81
I thought about this as well, but won't that cause a problem with any links to root in the current site?

Yeah, that would definitely be a problem with the first option. I don't deal with WordPress or Apache enough to know for sure, but I believe it is possible to conditionally redirect based on the referring/source page/domain so you could have requests from within the site not get the redirect. If the user is coming from another domain or source (Google or a direct link), they'd get the redirect to index.html or whatever you call it, but if it was from yourdomain.com, redirect to the usual / or whatever it is WordPress uses.

With the second option, it might not matter at all. If there are any links hard coded into the templates or in the posts, they would need to be changed. If you are using custom menus, you'd probably need to update those. If you aren't using custom menus, WordPress should dynamically update the menus for you.

NOTE: The second option will almost definitely mess with your "SEO stuff," so if that is something you care about, be cautious. The first option probably would too. In fact, I'm guessing that just about any option would.

NOTE PT. 2: I'm just trying to give you some ideas. Please don't take any of this as gospel as to how you should achieve what you are trying to do.
 

GregGreen

Golden Member
Dec 5, 2000
1,688
5
81
As I continue to think about it, what about displaying the info in a JS modal window on the homepage? Set a cookie the first time it is shown and then only show it if that cookie doesn't exist so people don't continually see it.