如何确保我的资源正确重定向? (阿帕奇/ PHP)

时间:2014-01-22 16:41:45

标签: php apache .htaccess xampp slim

你好,互联网的好人。我目前正在使用MicroPHP框架,Slim和XAMPP。也许这个问题在标准的Linux LAMP服务器中不存在,但无论如何。

RewriteEngine On

# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

根据文档,我已经设置了.htaccess并且实际的REST重定向到站点地址有效,但是额外的根级别资源(例如image,js,css文件)不会被重定向。 / p>

RewriteCond %{REQUEST_FILENAME} !-f

有!,意味着如果文件不存在则会发生重定向。

我理解逻辑,但它似乎不起作用。如何将我的资源重定向到正确的位置?

文件夹细分

/**index.php**
/css
/images
/Slim

等等。

任何直接的index.php请求都能正确获取资源 - 例如 127.0.0.1 / 127.0.0.1/index.php

使用mythical / user / SacredSkull URL时会出现问题,该URL确实执行了正确的功能,并将正确的用户从数据库中拉出来,但所有HTTP资源都被遗忘了。

如果答案显而易见或已经得到回答,我不会感到惊讶(我确实试图找到这个事先无效 - 可能是因为Slim ruby​​模板结果搞砸了事情)。请保持温柔:(我总是用非常长的杆子重写apache。

0 个答案:

没有答案
相关问题