Solved

.htaccess file exclusion

Posted on 2014-09-30
12
125 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
 

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with htaccess under apache 7 24
Apache web application(s) as Service Provider - ADFS 2.0 as IDP 4 85
Recompile PHP 5.5 with zip support for a newbe 8 114
htaccess file 3 74
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

910 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now