When you run Rails app using Phusion Passenger (modrails), by default, it runs in ‘production’ mode. However, if you want to run it in ‘development’ mode for any reason, you need to add a directive in your apache/nginx configuration.
Today I needed this trick. I was having some problem with one of my sites. I want to turn the site down while I am fixing it. But as the site is made with scatter html, php pages, it is not easy to centrally control maintenance mode. But I believed, this is possible by .htaccess trick. After searching a lot I have found a wonderful tutorial for it.
Here is the link of the tip/tutorial.
The tutorial is very easy to understand. If you understand .htaccess then here is the main part.
<Limit GET POST PUT>
deny from all
allow from 123.456.789
ErrorDocument 403 /custom-message.html
allow from all
It first deny all IPs’ access to the site (3rd line) then only allow the webmaster (4th line, you must put your own IP). At 6th line, we mention custom Forbidden (403) page. But it is worthless as we already denied all users (IPs) to all pages. So in next lines we exclusively allow all to our custom 403 page so that they can see only that page.
Just now Hasin Hayder, author of multiple books, has published a blog post how to host any wordpress.com blog virtually anywhere you wish. Using this simple script, you can host any wordpress.com blog in your own domain.
He wrote a simple proxy script and some codes in .htaccess file. Then the proxy script will fetch all contents from your original blog and show in your site.
Suppose, you have a blog in WordPress.com which URL is www.rajuru.wordpress.com. Using this script, you can host this same blog to somewhere like www.yourdomain.com.
The script does not yet support commenting. Currently it will redirect you to original blog for comment. But the author has just confirmed me that he will implement this part very soon.