Reputation: 31
presently I have my htaccess redirecting everything to another URL, unless it is in the forums folder...
RewriteEngine On
RewriteCond %{REQUEST_URI} !/Forum
RewriteRule ^.*$ http://www.newsite.com/ [R=301]
I have set up a sub-domain in my original site, using a folder called subdomain.
what I would like to do is retain my existing redirect, and prevent redirects of my subdomain
Upvotes: 3
Views: 3269
Reputation: 784888
If I understood your requirement following rules should work for you:
RewriteEngine on
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteCond %{HTTP_HOST} !^/subdomain\. [NC]
RewriteCond %{REQUEST_URI} !^/Forum [NC]
RewriteRule ^.*$ http://www.newsite.com/ [R=301,L]
R=301 will redirect with https status 301
L will make last rule
NC is for ignore (no) case comparison
Upvotes: 0
Reputation:
You should be able to combine your !/Forum condition with a new one, as follows:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(Forum|subdomain)
RewriteRule ^.*$ http://www.newsite.com/ [R=301]
That uses a regular expression which will match either "/Forum" or "/subdomain".
Upvotes: 1