Forum Moderators: phranque

Message Too Old, No Replies

rewrite rule to affect all but three folders

rewrite rule to affect all but three folders

         

optik

2:35 pm on Aug 17, 2007 (gmt 0)

10+ Year Member



I have need to write a rule that will redirect all subfolders except three folders on my site to a
php file in the main directory

something like this

RewriteRule ^(oneŠtwoŠthree/ - [S=1]
RewriteRule ^(.*)?$ /mod.php?

jdMorgan

2:56 pm on Aug 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You did not close the parentheses on your first rule. And [S=] flags can be a maintenance worry because you might forget to update the skip count as more rules are added, so I suggest:

RewriteCond $1 !^(oneŠtwoŠthree)/
RewriteRule (.*) mod.php [L]

"!" means "NOT" and $1 refers back to the value matched by the RewriteRule pattern.

Replace all broken pipe "¦" characters above with solid pipe characters before use; Posting on this forum modifies the pipe characters.

Jim