views:

19

answers:

2

in my .htaccess file i have the following

Options -Indexes
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteRule ^(.*)/(.*)$  index.php?lang=$1&id=$2 [L]

so when i wrote http://mydomain.com/am/home it will be redirected to http://mydomain.com?lang=am&id=home


but i have a cms folder, and i need to go to

http://mydomain.com/cms/index.php when wrote

http://mydomain.com/cms but it doesn't happen.

what can i do?

Thanks

A: 

Add:

RewriteRule ^(.*)/?$ $1/index.php [L]

webdestroya
it returns 500 error.
Syom
+1  A: 

Add a RewriteCond:

RewriteCond $1 !=cms
RewriteRule ^(.*)/(.*)$  index.php?lang=$1&id=$2 [B,L]

When you go to /cms, Apache probably does a 301 to /cms/, therefore your rewrite rule would match. This will avoid matching /cms/.

Artefacto
Great. Thanks much. but in this case $1 in RewriteCond refers to the next RewriteRule only? what about, iif i have many Rewriterules?
Syom
@Syom Yes, only the next. If you need for many, you try putting this one before the others: `RewriteRule cms/ - [L]`. The last (L) stops a round of replacements.
Artefacto