且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

阿帕奇重写URL,但不重写某些文件夹

更新时间:2023-09-18 23:32:46

 重写规则^ / lib目录/.+$  -  [L]
重写规则^(。*)的index.php
 

I am using Apache to rewrite my URLs into clean URLs.

RewriteRule ^(.*) index.php

Currently this rewrites directories too, which is what I want, since I want everything run through my router/index.php file.

What I would like to do however, is have one folder that I can access directly. This is for lib files such as .js and .css files. I know how to do this with an Alias, but I can't use that in a .htaccess file, which I need to use.

How can I not rewrite a specific folder, eg. called "lib"?

EDIT:

I did find the following example of how to fake an Alias in .htaccess, but I can't get it working:

RewriteRule /old-folder /new-folder [PT]

RewriteRule ^/?lib/.+$ - [L]
RewriteRule ^(.*) index.php