Skip folder in URL using htaccess

Discussion in 'Site & Server Administration' started by computerzworld, Sep 28, 2012.

  1. #1
    Hello,
    My folder structure is like this.

    /sites/1/index.html
    /sites/2/index.html
    /sites/3/index.html

    Where my sites folder is available on the root of the domain. I want to skip sites folder from the URL so that my URLs will be something like this.

    http://www.example.com/1

    instead of http://www.example.com/sites/1

    How can I do this using htaccess?

    Please help me.

    Thanks in advance.
     
    computerzworld, Sep 28, 2012 IP
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    230
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #2
    Add the following lines to your .htaccess file:

    RewriteEngine on
    RewriteRule (.*) sites/$1 [L]
     
    RoseHosting, Sep 28, 2012 IP