繁体   English   中英

网址重写问题

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM