Webserver

Forward your site to Coral Cache

If you’re getting hit with digg/slashdot/reddit traffic, you can easily forward you site to Coral Cache to relieve the strain.

RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^192.168.1.2$
RewriteCond %{HTTP_USER_AGENT} !^CoralWebPrx
RewriteCond %{QUERY_STRING} !(^|&)coral-no-serve$
RewriteCond %{HTTP_REFERER} ^http://(www.)?digg.com [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?slashdot.org [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?slashdot.com [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?fark.com [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?somethingawful.com [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?engadget.com [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?boingboing.net [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?del.icio.us
RewriteRule ^(.*)$ http://blog.analogpoint.com.nyud.net/$1 [R,L]

Webserver

Comments (0)

Permalink

Redirect to the HTTPS version of a page

I often have the problem that a client wants their customers to login on a secure site. The following .htaccess files are a simple way of accomplishing this by redirecting the the sercure version.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

If that doesn’t work, try this:

RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R]

Webserver

Comments (0)

Permalink

301 Redirect in .htaccess file

In the last couple of days, I’ve gotten an inordinate number of requests about how to do a 301 permanent redirect from the non-www version of the person’s domain name to the www version. So instead of copying and pasting the same information over and over again, I can just point people here.

So if you’re using Apache and you want to do this redirect, put the following code in a file called .htaccess in the root directory of your website. Note that it’s more efficient to use httpd.conf file if you have access to it.


RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]

Webserver

Comments (0)

Permalink