Solved

.htaccess file exclusion

Posted on 2014-09-30
12
138 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
Supports up to 4K resolution!

The VS192 2-Port 4K DisplayPort Splitter is perfect for anyone who needs to send one source of DisplayPort high definition video to two or four DisplayPort displays. The VS192 can split and also expand DisplayPort audio/video signal on two or four DisplayPort monitors.

 

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 500 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 500 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 500 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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