How to redirect all sub-directories.

2 replies
Hello,

Say I have a domain - name.com

I create a directory at name.com/abc

Now, I want user to be redirected to another domain when ever user visit the name.com/abc folder, even if user visit name.com/abc/1 which does not exist, but once user reach the abc folder, anything sub-folder in it, user will be redirected, any one know how to do this.

Thanks
#redirect #subdirectories
  • Profile picture of the author jeffreyhuan
    Insert these lines into your .htaccess file.

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^folder/ [NC]
    RewriteRule ^folder(.*)$ http://example.com$1 [R=301,L]

    Replace folder to your folder name and example.com to your new domain.
    {{ DiscussionBoard.errors[6613715].message }}
  • Profile picture of the author Sharpest Pen
    ...or, if you didn't want to program anything, just install this plugin, for free, to your WP installation:

    http://wordpress.org/extend/plugins/404-redirection/
    Signature
    Word by Word, What Your Customers Read Is Who You Become
    Who Are You To Your Customers?
    {{ DiscussionBoard.errors[6621782].message }}

Trending Topics