Forum Moderators: phranque

Message Too Old, No Replies

Subfolder Redirect using htaccess

Redirecting Subfolder

         

mjasra23

4:50 pm on Aug 6, 2007 (gmt 0)

10+ Year Member



I currently have the following code in my subfolder's htaccess file (it redirects the subfolder over to the new url perfectly):

RedirectMatch permanent ^/subfolder/?$ [site.com...]

How can I make it so that all subsequent folders underneath 'subfolder' get redirected to the same URL as well?

The following have not worked for me:

RedirectMatch permanent ^/subfolder/ [site.com...]

RedirectMatch permanent ^/subfolder/.* [site.com...]

jdMorgan

7:09 pm on Aug 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Create and use a back-reference:

RedirectMatch permanent ^/subfolder(/.+)?/?$ http://www.site.com$1/subfolder.aspx

Anything matching the optional parenthesized sub-pattern will be copied into variable "$1" and inserted into the substitution URL on the right.

Jim