Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

.htaccess file exclusion

Posted on 2014-09-30
12
Medium Priority
?
142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

661 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