How to redirect Wordpress to index?
- Started
- Last post
- 3 Responses
- nb
I'm setting up Wordpress as a simple CMS so my clients can update text on their site. I don't need the blog to be displayed publicly.
How can I redirect www.mydomain.com/wp/ to simply www.mydomain.com/index.php?
I'd like it so that if a visitor accidentally finds the /wp/ directory, they'll be redirected to the home page of the site.
I googled around, but can't find anything.
- bigtrickagain0
<meta http-equiv="refresh" content="0;url=http://http://www.mydomain.com/index.php">
put that in an index.html or index.php file and drop it in the /wp/ directory.
- bigtrickagain0
if you want logged-in wordpress users to be able to access /wp/, use this in index.php on that page:
<?php
if ( is_user_logged_in() == false ) {
?>
<meta http-equiv="refresh" content="0;url=http://http://www.mydomain.com/index.php">
<?php
};
?>
- nb0
^ Thanks! That was so simple, I didn't occur to me.
I did a little further research and it looks like the meta refresh is deprecated. Instead I used a 301 refresh by using the following as my /wp/index.php:
?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.mydomain.com/");…
exit();
?- And it seems to work for wp-created pages within the /wp/ directory. Bonus.nb