Link to home
Start Free TrialLog in
Avatar of hrolsons
hrolsonsFlag for United States of America

asked on

.htaccess file exclusion

I have an .htaccess file that is working great:
RedirectMatch 301 (.*)\.html$ http://newsite.com

Open in new window

How could I exclude the directory "http://newsite.com/Intranet/" from the redirect?
Avatar of Gary
Gary
Flag of Ireland image

RewriteCond %{REQUEST_URI} !^/intranet/ [OR]
RewriteCond %{REQUEST_URI} ^.html
RewriteRule (.*) http://newsite.com/ [L,R=301]

Open in new window

Avatar of hrolsons

ASKER

@Gary, do I put those 2 lines after my line OR instead of my line?
Instead of (I just made an amendment to it before you posted)
Doesn't seem to be working.  For instance, http://originalsite.com does not redirect and http://originalsite.com/Intranet/ does redirect to http://newsite.com
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Same exact results.  I wonder what's up?
I tried it locally and it works fine.
Give me some test url's
Can you post your htaccess as you have it now.
#RewriteEngine on
#RewriteCond %{REQUEST_URI} !^/CRM [NC]
#RedirectMatch 301 (.*)\.html$ http://originalsite.com
#RewriteCond %{REQUEST_URI} !^/ebay [NC]
#RewriteRule .* http://originalsite.com/ [R=301,L]
#RewriteCond %{REQUEST_URI} !^/Intranet/ [OR]
#RewriteCond %{REQUEST_URI} ^.html
#RewriteRule (.*) http://originalsite.com/ [L,R=301]

RewriteCond %{REQUEST_URI} !^/Intranet
RewriteCond %{REQUEST_FILENAME} .*\.html$
RewriteRule . http://originalsite.com [L]
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK, now we're moving in the right direction.  Same problem as original though, when I go to the original site, such as :

http://www.originalsite.com/Intranet

It goes to blueappleproperties.com.  I did make sure the "I" was capitalized.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial