How to redirect all sub-directories.

2 replies

Say I have a domain -

I create a directory at

Now, I want user to be redirected to another domain when ever user visit the folder, even if user visit 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.

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

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

    Replace folder to your folder name and 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:
    Word by Word, What Your Customers Read Is Who You Become
    Who Are You To Your Customers?
    {{ DiscussionBoard.errors[6621782].message }}

Trending Topics