阿帕奇重写URL,但不重写某些文件夹 [英] Apache rewrite URL but don't rewrite certain folder

查看:102
本文介绍了阿帕奇重写URL,但不重写某些文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Apache重写我的网址为清洁的网址。

 重写规则^(。*)的index.php
 

目前这种重写的目录也一样,这是我想要的,因为我想通过我的路由器/ index.php文件运行一切。

我想不过的事,就是有,我可以直接访问一个文件夹。这是LIB文件等的.js和.css文件。我知道如何使用别名做到这一点,但我不能用在.htaccess文件,我需要使用。

我怎么能不重写一个特定的文件夹,例如。所谓的LIB?

编辑:

我没有找到一个在.htaccess如何捏造别名下面的例子,但我不能得到它的工作:

 重写规则/旧文件夹/新文件夹[PT]
 

解决方案

 重写规则^ / 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

这篇关于阿帕奇重写URL,但不重写某些文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆