views:

609

answers:

1

On my Joomla site, I've added some fairly straight-forward RewriteRules to my .htaccess file. They're all one-to-one rules like this, since I'm changing the file structure of the site and don't want to break my old links.

RewriteRule ^content/view/54/48/$ /courses [R]

These are in addition to the existing rules that come packaged with Joomla:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

If I comment out the existing Joomla rules, then I can see that my rule is working correctly and when I type in http://example.com/content/view/54/48/ my browser address bar changes to http://example.com/courses, however if I leave those other rules, then Joomla doesn't know what to do with it (it gives an "unknown component error"). If I type in http://example.com/courses directly, then it works as expected, so I have a feeling it's a problem with my rewrite, not Joomla.

I thought that the RewriteRules acted upon each other in sequence. eg:

RewriteRule a b
RewriteRule b c   # a request for "a" will take you to "c"

I'm on shared hosting so unfortunately I can't turn the log on. Does anyone have any advice for me?

+2  A: 

Try changing the [R] in your rule to [R,L] ...

mjy
Maybe some people might benefit from knowing that [L] means "Last rule" and will stop the Joomla rules from executing when this rule has kicked in.
PEZ