Development Environment (wordpress)
I have been building a website that should be launching in approximately 1 month and the site is almost done, with one large exception: it's on the wrong domain.
On the main page of our domain (www.example.com) there is an under construction page which is collecting email addresses, as well as just a general landing page. Meanwhile at subdomain.example.com I have built the website.
The question then is: is there a way that I can keep the under construction landing page up but also move the wordpress site from subdomain.example.com to 开发者_运维问答run in the background on example.com somewhere. My concern is that when the site is finally ready and if I just ftp all the wordpress files to example.com there will be issues and I want to hammer those out before launch.
Yes, you can, by using .htaccess to filter the access.
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]
Just put this in your .htaccess (before all other instructions you might have in there) and everyone that doesn't have that IP will be redirected to soon.html.
This way you can keep developing on the same path that the final website will reside.
Notes: This will filter all other IPs, including pingbacks from third party entities. If you're using PayPal IPN or any other gateway that needs to comunicate with your website you will have to manually add that IP to the .htaccess (as explained on the code itself).
Hopefully this will help you.
精彩评论