编辑 .htaccess 重定向到 Error 404 Object not found
Editing .htaccess redirects to Error 404 Object not found
我目前正在编辑我的 .htaccess 文件以将任何请求重定向到我项目中的 public 文件夹,但我只是收到此错误
404 Object not found
下面是 .htaccess 文件夹中的代码
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule (.*) /public/
我不是很熟悉 htaccess 代码,这有什么问题吗?
更新
下面是我项目中的文件结构总结,如果对你有帮助的话
-projectfolder
|
|--.htaccess
|
|----includes
|
|----mvc
|
|----cache
|
|----public
提前致谢
您的 .htaccess 似乎不在 DocumentRoot
的正下方。试试这条规则:
RewriteEngine on
RewriteRule ^((?!public/).*)$ public/ [L,NC]
我目前正在编辑我的 .htaccess 文件以将任何请求重定向到我项目中的 public 文件夹,但我只是收到此错误
404 Object not found
下面是 .htaccess 文件夹中的代码
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule (.*) /public/
我不是很熟悉 htaccess 代码,这有什么问题吗?
更新
下面是我项目中的文件结构总结,如果对你有帮助的话
-projectfolder
|
|--.htaccess
|
|----includes
|
|----mvc
|
|----cache
|
|----public
提前致谢
您的 .htaccess 似乎不在 DocumentRoot
的正下方。试试这条规则:
RewriteEngine on
RewriteRule ^((?!public/).*)$ public/ [L,NC]