htaccess redirect from root to subfolder and then mask the url?

Posted by KiwiCoder on Stack Overflow See other posts from Stack Overflow or by KiwiCoder
Published on 2010-04-01T05:06:29Z Indexed on 2010/04/01 6:23 UTC
Read the original article Hit count: 459

Filed under:
|
|
|

Hello all,

Two things:

Firstly - I have version 2 of a website located in a folder named v2, and I want to redirect any traffic that is NOT a child of the v2 folder, to www.example.com/v2

The old site located in the root was created in iWeb and has a LOT of subfolders and sub-subfolders.

So:

www.example.com/v2 = New site

www.example.com/Page.html

www.example.com/category/Page.html

ww.example.com/category/subcategory/Page.html = All generic examples of what I need to redirect.

Secondly, and I don't know if this is possible, I want to hide /v2/ in the URL, so that visitors will just see www.example.com/page even though they are actually on www.example.com/v2/page

Links are hardcoded to the v2 folder, like so <a href="v2/contact.html">

Any help is MOST appreciated. I've spent hours trying to figure this out, but I'm only just learning about htaccess and regular expressions, and am totally confused.

Thanks so much!

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about subfolder