Htaccess File Inside The Folder.
Wall Script
Follow Me:
Wednesday, March 17, 2010

Htaccess File Inside The Folder.

How to use .htaccess file inside the folder. I'm using two .htaccess files in my hosting, one for labs.9lessons and another for touch.9lessons. Just take a look at this post how I had implemented.

Htaccess File Inside The Folder.

Original URL :
Friendly URL :

First .htaccess file
This code redirects sub domain pointing to touch folder.
RewriteEngine On

RewriteCond %{HTTP_HOST} ^touch\.9lessons\.info$
RewriteCond %{REQUEST_URI} !^/touch/
RewriteRule (.*) /touch/$1

Second .htaccess file
This file inside the touch directory. Contains single parameter URL rewriting code.
RewriteEngine On

RewriteBase /touch/

RewriteEngine On

RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?id=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?id=$1

Old Posts about .htaccess
  1. Redirect The Sub Domain To a Sub Folder with .htaccess
  2. URL Rewriting Tip with .htaccess File
  3. Pretty URLs with .htaccess Rewriting Tips.
  4. Add Security to your PHP projects using .htaccess file

Was this article helpful?
Thanks! Your feedback helps us to improve


  1. I know that .htaccess is used to password protect pages...this is an addon

  2. Like this d(^_^)b
    I need it ..
    thanks for share ..

  3. Hey, nice blog....keep up the good work...i was sitting next to you :) I blog at

  4. Hi Srinivas,
    Firstable I want to thank you for this wonderful tutorials.
    I am trying to implement Htaccess example into my localhost, but some how I am not succeeding.

    Here it is my url

    I would like to rewrite it into this format

    I have been trying a lot of examples but still I am not getting what I need. Even though I could create something similar I had troubles with my css files they are not loading unless i write their url ../../style.css

    Any kind of help will convenient.

    Thank You.

  5. Thats simple method to do mod rewrite URL, cool!

  6. Hi Srinivas

    how can I change this URL:


    I'm triying get rid of users dir using mod rewrite

  7. Hi,my english is not. < I do not < I do

    How can I do ?

  8. Your article is so interested and I'm one 9lessons followers
    I want to make it like that
    to be


Make in India