pavement

.htaccess

From FreeBSDwiki
Revision as of 18:08, 29 July 2012 by DavidYoung (Talk | contribs)
Jump to: navigation, search

You can place a .htaccess file in a directory serviced by apache to override server default behaviors without needing to alter httpd.conf or even to restart Apache - assuming, of course, that the directory in question has been allowed override privileges for the things you want to do!

For example, assuming mod_rewrite is installed and available in Apache, you can do the following in the .htaccess file in the root of a site to redirect an insecure http request to the same site via secure https:

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

Or if you want to block off a pesky spammer-ridden IP block from posting things to a blog or wiki, while still allowing people on that block to READ the blog or wiki or what have you:

AuthName "Anti-Spam Protection"
AuthType Basic
<Limit PUT POST>
order allow,deny
allow from all

# CHINANET telcom - 2006-03-02
deny from 212.0.0.0/8
deny from 216.0.0.0/8
deny from 218.0.0.0/8
deny from 221.0.0.0/8
deny from 61.144.0.0/14
</Limit>

Note that comments - prefaced by # signs - ARE allowed in .htaccess files. Use this to your advantage!

What if you want to require a password for a certain directory?

# require a username and password to get into this lightly secured area
AuthType Basic
# note: it's safest to keep the password file OUTSIDE the webroot!
AuthUserFile ../.htpasswd
AuthName "JRS Systems Personnel Only"
require valid-user
satisfy any

Of course, this requires you to actually have a .htpasswd file in the appropriate location - you can use the htpasswd utility to create one for you.

Contents

12 Lessons To Learn From Highly Successful People

The only work that will ultimately bring any good to any of us is the work of contributing to the healing of the world. Marianne WilliamsonSuccess can mean different things to different people, and I noticed that many of us have some kind of resistance to the word success, even though deep down inside, that is exactly what we all want, to live a successful and meaningful life.

[12 Lessons To Learn From Highly Successful People]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

12 Lessons To Learn From Highly Successful People

The only work that will ultimately bring any good to any of us is the work of contributing to the healing of the world. Marianne WilliamsonSuccess can mean different things to different people, and I noticed that many of us have some kind of resistance to the word success, even though deep down inside, that is exactly what we all want, to live a successful and meaningful life.

[12 Lessons To Learn From Highly Successful People]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

Man Climbs Worlds 14 Tallest Peaks

Hirotaka Takeuchi has gotten official certification for his feat of climbing the worlds 14 tallest mountains. Hes the 30th person ever and the first Japanese person to accomplish the feat.

[Man Climbs Worlds 14 Tallest Peaks]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

The Limitations of Positive Thinking

Positive thinking is so firmly enshrined in our culture that knocking it is a little like attacking motherhood or apple pie. Many persons swear by positive thinking and quite a few have been helped by it. Nevertheless, it is not a very effective tool and can be downright harmful in some cases. There are much better ways to get the benefits that positive thinking allegedly provides.

[The Limitations of Positive Thinking]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

Dalai Lama Awarded 2012 Templeton Prize

The Dalai Lama, the Tibetan Buddhist spiritual leader whose long-standing engagement with multiple dimensions of science and with people far beyond his own religious traditions has made him an incomparable global voice for universal ethics, nonviolence, and harmony among world religions, has won the 2012 Templeton Prize.

[Dalai Lama Awarded 2012 Templeton Prize]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

Personal tools