【问题标题】:Editing .htaccess redirects to Error 404 Object not found编辑 .htaccess 重定向到错误 404 找不到对象
【发布时间】:2015-02-18 12:03:41
【问题描述】:

我目前正在编辑我的 .htaccess 文件以将任何请求重定向到我的项目中的公用文件夹,但我只是收到此错误

404 找不到对象

下面是.htaccess文件夹中的代码

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/public/
RewriteRule (.*) /public/$1

我对 htaccess 代码不是很熟悉,这有什么问题?

更新

下面是我项目中的总结文件结构,如果有帮助的话

-projectfolder
|
|--.htaccess
|
|----includes
|
|----mvc
|
|----cache
|
|----public

提前致谢

【问题讨论】:

标签: php apache .htaccess mod-rewrite redirect


【解决方案1】:

您的 .htaccess 似乎不在DocumentRoot 的直接下方。试试这个规则:

RewriteEngine on

RewriteRule ^((?!public/).*)$ public/$1 [L,NC]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-20
    • 1970-01-01
    • 2018-06-06
    • 2018-12-09
    • 1970-01-01
    • 2014-08-11
    相关资源
    最近更新 更多