Solved

Conflict using RewriteRules

Posted on 2013-01-01
9
212 Views
Last Modified: 2013-02-04
I currently have the following .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

RewriteRule ^redirect-to/(.*)$ index.php?cID=467&to=$1 [NC,L]
</IfModule>

Open in new window


I really need the
RewriteRule ^(.*)$ index.php/$1
, as it is the base for our CMS. However, the other line, "redirect-to" does not work. If I take out the first line, needed by the CMS, it works, if I add it together with the other, it fails... 500 errors.

I think it has to do because the first is a site-wide rewrite, and redirect-to is more specific. How can I get these to work together?
0
Comment
Question by:redworks
[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
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38734612
Have you tried putting that rule  before the other?

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^redirect-to/(.*)$ index.php?cID=467&to=$1 [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

</IfModule>

Open in new window

0
 

Author Comment

by:redworks
ID: 38734614
Yes, I did. Gives me a 500 Internal Server Error.
0
 
LVL 13

Expert Comment

by:Sandy
ID: 38735775
check application option also for SEO optimization.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:redworks
ID: 38741535
I did, thats not the issue. They use the .htaccess for SEO control.
0
 
LVL 29

Accepted Solution

by:
fibo earned 500 total points
ID: 38760326
I would think that line 9 in kaufined's suggestion needs something that says "final" and does not loop. So I would test writing it as:
RewriteRule ^(.*)$ index.php/$1 [L,NC]

Open in new window

0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38761651
@fibo

Doesn't that only matter if more rules follow the rule in question?
0
 
LVL 29

Expert Comment

by:fibo
ID: 38825751
No it does not matter if more rules follow in your script.
But it does matter if they are used or not after a previous rewrite.
The [L] says "do not go further in this file"... which in the last example I gave would go to the "new url"... which would then pass again thru the htaccess file.
So the "new url" will now go against all the rewrite rulen beginning at the top of the file.
0
 

Author Closing Comment

by:redworks
ID: 38850707
This worked, great :)
0
 
LVL 29

Expert Comment

by:fibo
ID: 38850806
B-) Glad it helped. Thx for the grade and points!
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

752 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