仅当请求不是以'/THEMES/'开头时,Apache mod_rewrite [英] Apache mod_rewrite only if request does not start with '/THEMES/'
本文介绍了仅当请求不是以'/THEMES/'开头时,Apache mod_rewrite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在用PHP编写CMS,现在我正在使用主题功能.我有一个.htaccess文件:
I'm writing a CMS in PHP, and now I'm working at the themes feature. I have a .htaccess file:
RewriteEngine ON
RewriteRule ^([a-zA-Z][a-zA-Z0-9]*)$ index.php?m=$1
RewriteRule ^([a-zA-Z][a-zA-Z0-9]*)/(.+)$ index.php?m=$1&p=$2
如果我有以下要求:
/page
它必须加载名为page的类的视图函数.
it must load the view function of the class called page.
如果我有以下要求:
/page/test
它必须使用参数"test"加载名为page的类的视图函数. 这一切都可以,
it must load the view function of the class called page, with the parameter 'test'. This all works,
但是,如果请求确实不以
开头,我希望它仅应用RewriteRules :
But I want it to apply the RewriteRules ONLY if the request does NOT start with:
/THEMES/
所以我可以应用CSS样式等...
So I can apply CSS styles etc...
有人可以帮助我吗?谢谢.
Can anyone help me? Thanks.
推荐答案
您可以使用其他规则来停止重写过程:
You could use an additional rule to stop the rewriting process:
RewriteRule ^THEMES/ - [L]
RewriteRule ^([a-zA-Z][a-zA-Z0-9]*)$ index.php?m=$1
RewriteRule ^([a-zA-Z][a-zA-Z0-9]*)/(.+)$ index.php?m=$1&p=$2
这篇关于仅当请求不是以'/THEMES/'开头时,Apache mod_rewrite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文