开发者

.htaccess root only redirect issue with WordPress

I am working on a site which people already know the URL of. Naturally, I don't want them to see it in progress, so I wrote an .htaccess rule to redirect all traffic to www.example.com to /temp/index.html which is an under construction page.

What I want to do now is to have some sort of link that I can give to the client, that will link to the WordPress homepage. Unfortunately, WordPress already has .htaccess rules in place to rewrite everything to not include the index.php. Therefore, any time I click on the "Home" link on the pa开发者_JAVA技巧ge, it goes to the under construction page, and I am never able to see the homepage.

Here is the code that is in .htaccess currently, including my redirect:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
RewriteEngine on
RewriteCond %{HTTP_HOST} ^journeyfx\.com$
RewriteRule (.*) http://www.journeyfx.com/$1 [R=301,L]
RewriteRule ^$ /temp/index.html [L]

Any idea how to do this without relocating the whole WP site to a new directory?


Well, you can make it more simple, make a new user for your client then tell him to login from yourwebsite.com/wp-login.php then add this to your header.php (from the first line.)

<?php if(!is_user_logged_in()) { wp_redirect(get_bloginfo('url') . '/new-path.html'); } ?>

(if user is not logged in it will be redirected to yourwebsite.com/new-path.html)


Just put the index.html file in the same directory as WordPress' index.php. Because .html is usually listed higher in the DirectoryIndex directive, it will get precedence and load before the .php file unless explicitly stated. Users going to journeyfx.com will see the "Under Construction" page, while if you put journeyfx.com/index.php, you'll get WP.

If it doesn't load in that order, you may need to add the following to .htaccess:

DirectoryIndex index.html index.php
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜