Jump to content

Need help with RewriteRule and RewriteCond.


The Bat

Recommended Posts

I have an .htaccess file which contains RewriteRule and RewriteCond statements. Here is the code (snippets are examples):

 

RewriteCond %{REQUEST_URI} /cat [OR]
RewriteRule ^([^/\.]*)/?$ cat.php?kitty=$1 [L]

 

That way when the URL is mysite.com/cat/foo, foo is kitty. The problem is that "kitty" is applied to all pages. I tried adding

 

RewriteCond %{REQUEST_URI} !(/cat) [OR]
RewriteRule ^([^/\.]*)/?$ index.php?something=$1 [L]

 

So that if the URL does not end with /cat, "kitty" will be "something". But this does not work. How can I fix this? Thank you!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.