重定向至“子文件夹中的索引”诊断树


Redirect to index in subfolder

我在root/en里面有一个.htaccess文件,当你输入URL时root/en我希望网站重定向到root/en/public/index.php并在那里找到索引。我有这个解决方案,但由于某种原因它不起作用:

RewriteEngine on
RewriteBase /en
ReWriteCond %{REQUEST_URI} !en/public/
ReWriteRule ^(.*)$ en/public/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule .* index.php?/$0 [PT,L] 

如果您将其用作前端控制器,请使用:

RewriteEngine on
RewriteBase /en/
RewriteRule ^$ public/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!public/).+)$ public/index.php/$1 [L,NC]