我一直在建立一个网站,应该在大约一个月内推出,该网站几乎完成,但有一个大的例外:它在错误的域名。
在我们的域名(www.example.com)的主页上有一个正在建设中的页面,它正在收集电子邮件地址,以及只是一个一般的登陆页。与此同时,在subdomain.example.com,我已经建立了这个网站。
那么问题是:有没有一种方法可以让正在建设中的登录页面保持在线,同时还可以将wordpress站点从subdomain.example.com移到example.com上的某个后台运行。我担心的是,当网站最终准备就绪时,如果我只是将所有的wordpress文件通过ftp传输到example.com,就会出现问题,我想在发布之前敲定这些问题。
发布于 2011-09-16 23:52:34
是的,您可以,通过使用.htaccess过滤访问。
RewriteEngine On
RewriteBase /
# Your IP Address
RewriteCond %{REMOTE_ADDR} !^192\.168\.0\.1$
# More IPs
#RewriteCond %{REMOTE_ADDR} !^255\.255\.255\.255$
RewriteCond %{REQUEST_URI} !^/soon.html$
# If you need to also give access to some specific folder (for example images)
# you can use the following instruction
#RewriteCond %{REQUEST_URI} !^/images/.*$
# This line says: redirect to soon.html.
# This is a redirect (sent back to the browser), so the full URL is required.
# We're using 302 because sooner or later you'll open the website for everyone.
RewriteRule ^(.*)$ http://www.example.com/soon.html [R=302,L]只需把它放到你的.htaccess中(在你可能有的所有其他指令之前),所有没有这个IP的人都会被重定向到soon.html。
这样你就可以在最终网站所在的同一条道路上继续开发。
注意:这将过滤所有其他IP,包括来自第三方实体的pingback。如果您使用的是PayPal IPN或任何其他需要与您的网站通信的网关,则必须手动将该IP添加到.htaccess中(如代码本身所述)。
希望这能对你有所帮助。
https://stackoverflow.com/questions/7446546
复制相似问题