[英]url rewriting problem
在我的.htaccess
文件中,我有以下内容
Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/(.*)$ index.php?lang=$1&id=$2 [L]
所以当我写http://mydomain.com/am/home
,它将被重定向到http://mydomain.com?lang=am&id=home
但是我有一个cms
文件夹,我需要转到
撰写时http://mydomain.com/cms/index.php
http://mydomain.com/cms
但不会发生。
我能做什么?
谢谢
添加一个RewriteCond
:
RewriteCond $1 !=cms
RewriteRule ^(.*)/(.*)$ index.php?lang=$1&id=$2 [B,L]
当您转到/cms
,Apache可能会对/cms/
执行301,因此您的重写规则将匹配。 这将避免匹配/cms/
。
加:
RewriteRule ^(.*)/?$ $1/index.php [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.