combining two different htaccess methods into one

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-06-10T17:15:33Z Indexed on 2010/06/10 17:32 UTC
Read the original article Hit count: 361

Filed under:

Im having trouble getting this htaccess to work properly.

This is my file as it stands

RewriteEngine on 
RewriteBase /
RewriteRule ^sam/$ animals.php [QSA]
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)|(\.swf)|(\.xpi)|(\.ico)|(\.src)$ 
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteRule (.*)$ get.php?code=$1 [L]

When i use

RewriteEngine on 
RewriteBase /
RewriteRule ^sam/$ animals.php [QSA]

or

RewriteEngine on 
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)|(\.swf)|(\.xpi)|(\.ico)|(\.src)$ 
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteRule (.*)$ get.php?code=$1 [L]

independently, it works fine, but together neither work properly.

Here is what im trying to do:

Any requests sent to domain.com/sam/?whatever=dogs, will get sent to domain.com/animals.php?whatever=dogs

Any requests sent as domain.com/whatever, will get sent to domain.com/get.php?code=whatever

© Stack Overflow or respective owner

Related posts about .htaccess