Conflict using RewriteRules

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?
redworksAsked:
Who is Participating?
 
fiboConnect With a Mentor Commented:
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
 
käµfm³d 👽Commented:
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
 
redworksAuthor Commented:
Yes, I did. Gives me a 500 Internal Server Error.
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
SandyCommented:
check application option also for SEO optimization.
0
 
redworksAuthor Commented:
I did, thats not the issue. They use the .htaccess for SEO control.
0
 
käµfm³d 👽Commented:
@fibo

Doesn't that only matter if more rules follow the rule in question?
0
 
fiboCommented:
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
 
redworksAuthor Commented:
This worked, great :)
0
 
fiboCommented:
B-) Glad it helped. Thx for the grade and points!
0
All Courses

From novice to tech pro — start learning today.