RewriteCond not recognized

software development

#1

I’ve been going nutz trying to figure out what I’m doing wrong here.

I want my url to auto rewrite to a sub directory, but my RewriteCond is not being recognized.

Ex. I want kason.es/anything to be rewritten to kason.es/cobedo/anything

Here is the code in my .htaccess file:

[code]Options +FollowSymlinks
RewriteEngine on

RewriteCond %[REQUEST_URI] !^/cobedo/.*
RewriteRule ^(.*)$ http://www.google.com [L][/code]

Right now i just have it rewriting to google to test it out.

The problem that I am running into is that the url is getting rewritten even when i am in the /cobedo directory.

So this line is failing and I have no idea why:
RewriteCond %[REQUEST_URI] !^/cobedo/.*

Any suggestions?

Thanks!


#2

Curly brackets on the variable, not square brackets.


#3

That did not work :frowning:


#4

are you requesting something in cobedo or just xxx.com/cobedo? because your condition is that there must be something there. you can add (/.)? to make it optional

also, adding [NC] makes it case insensitive


#5

Arg, that did it. I’m a little embarrassed at the solution. Thanks guys!!!