What is the .htaccess/mod_rewrite solution for this redirect problem?

Mod_rewrite will, by default, only use directives from a single htaccess file per (internal) request, and the htaccess file used will be the last one found to have mod_rewrite directives down your request path In this case fb_calendar/. Htaccess exists and contains directives, so they are used instead of the directives in your root Furthermore, note that none of the directives are inherited automatically, so doing something like the following will generate a 404, since directives are present, but the RewriteEngine was never turned on in the second file: htaccess : RewriteEngine On RewriteCond %{REQUEST_FILENAME}! -f RewriteRule ^ /index.

Php? Here test/. Htaccess : RewriteRule ^ /index.

Php? There Request http://example.com/test/non-existent-path As it turns out, you can import rules from parent htaccess files using the RewriteOptions directive: RewriteEngine On RewriteOptions inherit Note that the parent rule set is imported after the existing rule set though, so in your case the path would be rewritten to fb_calendar/app/webroot/events/view before being processed by the rule in your root htaccess file (and would therefore not match) Your options in that case would be to either modify your rule to accommodate for that, or, perhaps more easily, you could just move your rule to the fb_calendar/. Htaccess file and adjust it for being in that directory.

Mod_rewrite will, by default, only use directives from a single . Htaccess file per (internal) request, and the . Htaccess file used will be the last one found to have mod_rewrite directives down your request path.In this case, .../fb_calendar/.

Htaccess exists and contains directives, so they are used instead of the directives in your root. Furthermore, note that none of the directives are inherited automatically, so doing something like the following will generate a 404, since directives are present, but the RewriteEngine was never turned on in the second file: /. Htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME}!

-f RewriteRule ^ /index. Php? Here /test/.

Htaccess: RewriteRule ^ /index. Php? There Request -> http://example.com/test/non-existent-path As it turns out, you can import rules from parent .

Htaccess files using the RewriteOptions directive: RewriteEngine On RewriteOptions inherit Note that the parent rule set is imported after the existing rule set though, so in your case the path would be rewritten to .../fb_calendar/app/webroot/events/view/... before being processed by the rule in your root . Htaccess file (and would therefore not match). Your options in that case would be to either modify your rule to accommodate for that, or, perhaps more easily, you could just move your rule to the .../fb_calendar/.

Htaccess file and adjust it for being in that directory.

Useful info, thanks. – Owen Sep 13 '10 at 23:01.

RewriteRule ^home/templates/cnb/fb_calendar/events/view/(^/\. +)? $ /home/index.

Php? Option=com_content&task=view&id=574&Itemid=85&direct=view:$1 R=302,L I just removed the from the url it redirects to. Works like a charm.

Test it here: manson.revora. Net/home/templates/cnb/fb_calendar/events/view/1234 goes to manson.revora. Net/home/index.

Php? Option=com_content&task=view&id=574&Itemid=85&direct=view:1234 Also, this rewrites the url in the address bar too, but since you added R=302 I take it that's what you wanted? And you don't need that first rule, as pointed out in the comments.

This fails in my particular circumstance - I think there is another . Htaccess file in a directory on the target path that's interfering - please see Additional information I've edited at the end of my question. Thanks!

– Owen Sep 9 '10 at 8:55 Yes, that . Htaccess definitely interferes, for it sends all requests that end up in the fb_calendar folder to the subfolder /app/webroot/. I don't think it's possible to have a .

Htaccess rule that overwrites rules in subdirectories, that's just the way htaccess rules work.. You could change the htaccess in the fb_calender folder though but that might mean you're going to have to do that in a lot more folders. – Stephan Muller Sep 9 '10 at 9:15 Hmm... that's a bit annoying - I want it to rewrite the whole path as it is defined, not parse any other rules along the way. Powerful feature, but if that's not the behaviour you want then it's a big limitation.

– Owen Sep 9 '10 at 9:43 Wait a second, I might be wrong. The request goes from base folder down to subfolders, but in the base folder you already say you want to rewrite fb_calender to something else. This shouldn't even hit your fb_calendar at all.

Maybe there's something else interfering after all. – Stephan Muller Sep 9 '10 at 9:49.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions