阿帕奇:如何使用重写引擎内部别名 [英] Apache : How to Use Rewrite Engine Inside Alias

查看:208
本文介绍了阿帕奇:如何使用重写引擎内部别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个别名的配置:

Alias /test/ "D:/WWW/Test/"
<Directory "D:/WWW/Test/">
    Order allow,deny
    Allow from all
</Directory>

然后在 D:/ WWW /测试/ 目录,我把htaccess的,配置如下:

Then inside D:/WWW/Test/ directory, I put .htaccess with the following configuration:

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteRule ^([^.]*\.css)$ resources/$1 [L,NC]
</IfModule>

我只是想重定向从本地主机/测试/ CSS / * 本地主机/测试/资源/ CSS / *

但似乎的.htaccess 被忽略。即使我把的DirectoryIndex blablabla.php ,浏览器仍然显示的index.html。

But it seems that the .htaccess is ignored. Even if I put DirectoryIndex blablabla.php , browser still displays index.html.

如何解决此问题?谢谢你。

How to solve this? Thank you.

推荐答案

您需要三样东西:

  1. &LT;目录&GT; ,允许使用.htaccess文件的AllowOverride全部
  2. 提供的mod_rewrite的权限与有FollowSymLinks
  3. 在的.htaccess,包括的RewriteBase /测试/
  1. Inside <Directory>, allow .htaccess files with AllowOverride All.
  2. Give the required permissions of mod_rewrite with Options FollowSymLinks.
  3. Inside the .htaccess, include RewriteBase /test/.

这篇关于阿帕奇:如何使用重写引擎内部别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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