我有:
public/
-- index.php
-- my_subdir/
---- index.php
我只是想重新路由到 my_subdir。
(为什么?因为 my_subdir 包含我的新 joomla 网站。)
编辑,解释为什么所有其他解决方案都不起作用......我已经为此工作了几个小时,但没有任何效果。即使这里接受的答案最初也不起作用。问题不是谷歌提供的许多解决方案,而是我有冲突的规则/条件。
所以这是一个我没有工作的例子(箭头右边的东西是我需要让一切正常工作的东西):
RewriteEngine on
<<<< RewriteCond %{REMOTE_HOST} !^111\.111\.111\.111
######## my ip address for testing
######## because this was not originally included,
######## apparently I was being redirected to maintenance.html ...
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteRule $ /maintenance.html [R=302]
######## thus by the time the script/server got to this line
######## I was actually at maintenance.html,
######## and so this next condition did not apply to me
RewriteCond %{REQUEST_URI} !^/my_subdir
RewriteRule ^.*$ /my_subdir/$0 [L]