Reputation: 73
I have a site with a ton of backlinks pointing to a directory /portfolio/ and subfolders therein and I want to redirect them all to the root (because some of those old sub subdirectories are gone completely) of the new directory /project-portfolio/
The problem is that there is another /portfolio/ that I don't want rewritten or redirected...it resides deeper in another subdirectory /uploads/images/portfolio/
How do I write my rewrite rule so that it applies to a top subdirectory /portfolio/ but ignores the other?
Thanks.
Upvotes: 0
Views: 102
Reputation: 143906
In your document root, create an htaccess file and add this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/uploads/images/portfolio
RewriteRule (^|/)portfolio(/|$) /project-portfolio/ [L,R=301]
Upvotes: 1
Reputation: 3840
<Directory /path/to/docroot/folder>
Options +Indexes
</Directory>
<DirectoryMatch /path/to/docroot/folder/(.)*/>
Options -Indexes
</DirectoryMatch>
Upvotes: 0