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

编程入门 行业动态 更新时间:2024-10-22 12:21:47
本文介绍了阿帕奇重写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,但不重写某些文件夹

本文发布于:2023-11-01 20:17:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550309.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   但不   文件夹   阿帕奇   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!