(Please see important Additional information edited in near the bottom of question)
I'm trying to get the following url
http://www.example.co.uk/home/templates/cnb/fb_calendar/events/view/289
to redirect to
http://www.example.co.uk/home/index.php?option=com_content&task=view&id=574&Itemid=85&direct=view:289
I thought this would work
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^home/templates/cnb/fb_calendar/events/view/([^/\.]+)?$ http://www.example.co.uk/home/index.php?option=com_content&task=view&id=574&Itemid=85&direct=view:$1 [R=302,L]
but it didn't. The rule does not 'engage' at all - original url goes through unchanged. What am I doing wrong?
I'm including the whole .htaccess file below: the rule I'm talking about is the fourth one down. (The file was mostly generated by cpanel utility rather than by hand.)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^approve/([^/\.]+)/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=574\&Itemid\=85\&approve\=$1" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^disapprove/([^/\.]+)/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=574\&Itemid\=85\&disapprove\=$1" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^direct/([^/\.]+)/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=574\&Itemid\=85\&direct\=$1" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^home/templates/cnb/fb_calendar/events/view/([^/\.]+)?$ http://www.example.co.uk/home/index.php?option=com_content&task=view&id=574&Itemid=85&direct=view:$1 [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^uk/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=6\&Itemid\=7" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^inspirational/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=7\&Itemid\=8" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^gospel/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=1\&Itemid\=3" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^bible/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=1\&Itemid\=2" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^dab/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=14\&Itemid\=35" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ "http\:\/\/www\.example\.co\.uk\/home" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^abi/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=20\&Itemid\=37" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^anne/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=16\&Itemid\=55" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^ben/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=25\&Itemid\=56" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^catherine/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=22\&Itemid\=57" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^dave/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=26\&Itemid\=53" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^jan/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=21\&Itemid\=58" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^nick/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=23\&Itemid\=60" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^paul/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=18\&Itemid\=59" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^robbie/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=17\&Itemid\=61" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^roy/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=15\&Itemid\=54" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^ruth/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=19\&Itemid\=62" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^steve/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=14\&Itemid\=64" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^trevor/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=24\&Itemid\=63" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^jobs/?$ "http\:\/\/www\.ucb\.co\.uk\/vacancies" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^prayer/?$ "http\:\/\/www\.ucb\.co\.uk\/prayer" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^yousay/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=11\&Itemid\=31" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^christmasappeal/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=12\&Itemid\=32" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^luke/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=29\&Itemid\=68" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^juls/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=blogcategory\&id\=30\&Itemid\=71" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^tv/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=5\&Itemid\=6" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^canigetdab/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=14\&Itemid\=35" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^playlist\/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_wrapper\&Itemid\=74\/" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^books\/?$ "http\:\/\/www\.example\.co\.uk\/" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^bookcase\/?$ "http\:\/\/www\.example\.co\.uk\/" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^donate\/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=12\&Itemid\=32\/" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^haiti\/?$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=560\&Itemid\=78\/" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^easter$ "http\:\/\/www\.example\.co\.uk\/" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^social$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=568\&Itemid\=81" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^orgs$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=8\&Itemid\=28" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^cnb$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=574\&Itemid\=85" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^cnb\/login$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=574\&Itemid\=85\&login\=" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^noticeboard$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=574\&Itemid\=85" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^noticeboard\/login$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=574\&Itemid\=85\&login\=" [R=302,L]
RewriteCond %{HTTP_HOST} ^example.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.co.uk$
RewriteRule ^bagofhope$ "http\:\/\/www\.ucb\.co\.uk\/bagofhope" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^mp3stream$ "http\:\/\/example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=577\&Itemid\=87" [R=302,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^posters$ "http\:\/\/www\.example\.co\.uk\/home\/index\.php\?option\=com_content\&task\=view\&id\=579\&Itemid\=88" [R=302,L]
-- Edit -- Additional information:
I've narrowed the problem down to the fb_calendar directory - if I use a directory with a random name instead of fb_calendar it works. So it must be something IN this directory that's causing the problem. There is another .htaccess file in this directory with the following contents:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Is this causing the problem? I need a rewrite rule that will not be effected by any other .htaccess files/rewrite rules in folders on the path in the URL. How can I do this?