Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

.htaccess file exclusion

Posted on 2014-09-30
12
Medium Priority
?
147 Views
Last Modified: 2014-10-01
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?
0
Comment
Question by:hrolsons
  • 7
  • 5
12 Comments
 
LVL 58

Expert Comment

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

Open in new window

0
 

Author Comment

by:hrolsons
ID: 40353234
@Gary, do I put those 2 lines after my line OR instead of my line?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40353235
Instead of (I just made an amendment to it before you posted)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:hrolsons
ID: 40353282
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
0
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 40353355
RewriteCond %{REQUEST_URI} !^/intranet
RewriteCond %{REQUEST_FILENAME} .*\.html$
RewriteRule . http://testsite.com [L]

Open in new window

0
 

Author Comment

by:hrolsons
ID: 40355020
Same exact results.  I wonder what's up?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40355030
I tried it locally and it works fine.
Give me some test url's
0
 
LVL 58

Expert Comment

by:Gary
ID: 40355137
Can you post your htaccess as you have it now.
0
 

Author Comment

by:hrolsons
ID: 40355188
#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]
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 2000 total points
ID: 40355192
You've commented out this line

#RewriteEngine on
^
0
 

Author Comment

by:hrolsons
ID: 40355221
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.
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 2000 total points
ID: 40355232
You can ignore case by changing to

RewriteCond %{REQUEST_URI} !^/intranet [NC]

But I'm confused, when I go to this page I get a 404 - so it is not redirecting which I assume is correct
http://www.originalsite.com/intranet/

Edit
Actually with the capital I - I get the login form, you may need to clear your browser cache, especially if it is FF
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question