我在root/en
内有一个.htaccess文件,当您输入网址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]
答案 0 :(得分:0)
如果您将其用作前置控制器,请使用:
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]