.htaccess Tutorials & Tips

PHP Class for Handling .htpasswd and .htgroup (Member Login & User Management)

Apache is a marvelous web server that offers .htpasswd and .htgroup for controlling restricted access to your website. By help of .htaccess, they work as a member login & user management system that is so simple and easy to deploy. You can even define user groups / roles with it. Basically, .htpasswd defines pairs of …

PHP Class for Handling .htpasswd and .htgroup (Member Login & User Management) Read More »

<IfModule></IfModule> in .htaccess

I was debugging about some mod_rewrite errors caused by the .htaccess file on one of my sites and couldn’t solve the problem myself so I opted for a help thread on the SitePoint.com forum. Turned out it’s not the problem of my mod_rewrite rules in .htaccess but some incorrect file permissions that were causing the …

<IfModule></IfModule> in .htaccess Read More »

Use .htaccess to allow access only from a single HTTP referrer

Sometimes you want the user to access something (a web page or a downloadable file) only by clicking a link on your own website instead of being able to directly access it by typing in the URL address in the browser address bar. This is achievable by a few lines in .htaccess. RewriteEngine On RewriteCond …

Use .htaccess to allow access only from a single HTTP referrer Read More »

Turn off and disable magic_quotes_gpc in .htaccess

It’s not only insecure but it inconveniently commands the use of PHP function stripslashes() every time you pull something from the database or when you get something from the client side. While most of the hosts out there are using factory settings of PHP that turn off magic_quotes_gpc by default, there are a few that …

Turn off and disable magic_quotes_gpc in .htaccess Read More »

Set Expiration or Expiring Time by mod_expires.c on Apache via .htaccess to Reduce Web Page Loading Time

When your site’s ready in design and majority of common media resources won’t change for quite some time, say, half a year, for example, the images and flashes. It makes sense to set the expiration of them much longer than the default to prevent the client browsers downloading them every time a visitor drops by, …

Set Expiration or Expiring Time by mod_expires.c on Apache via .htaccess to Reduce Web Page Loading Time Read More »

.htaccess: Deny From All – Prohibit, Forbid or Restrict Directory Access

Restricting directory access might be one of the most frequently used .htaccess techniques out there. As a site grows, there always are some areas that you don’t want visitors to look at such as merchandise warehouse where you store digital products for sale. You want a programmed server-side script to serve the download after confirming …

.htaccess: Deny From All – Prohibit, Forbid or Restrict Directory Access Read More »

.htaccess: Directory Listing — Enable Web Directory Browsing & Indexing

One of the best things I love Apache web server is that it instantly enables you to share files and resources via plain web directory index listing without having to spend time making any fancy web pages to serve them. However, there are times when you need to hide things out. To disable web directory …

.htaccess: Directory Listing — Enable Web Directory Browsing & Indexing Read More »

12 Most Used .htaccess Examples, Tips – Commands & Directives

Updated: added a 301 redirect directive. Whatever you wanto call this, a cheat sheet, a real thin manual, or anything, we simplify the use of .htaccess as much as possible and make it do more for you with less hassle. Unify kavoir.com and www.kavoir.com! # Use a 301 redirect from kavoir.com to www.kavoir.com to tell …

12 Most Used .htaccess Examples, Tips – Commands & Directives Read More »

Scroll to Top