Regex 重定向不使用.htaccess

Regex 重定向不使用.htaccess,regex,apache,.htaccess,mod-rewrite,ubuntu-14.04,Regex,Apache,.htaccess,Mod Rewrite,Ubuntu 14.04,我在我的htaccess中有这个 Options +FollowSymlinks RewriteEngine On Deny from all #RewriteRule (.*) http://google.com [R=301,L] Allow from 127.0.0.1 Allow from 89.32.93.99 RewriteRule index.php$ /otherfolder [R=301,L] 我正在尝试将所有请求重定向到一个新文件夹,但由于某些原因,上面的操作不起作用 我

我在我的htaccess中有这个

Options +FollowSymlinks
RewriteEngine On
Deny from all
#RewriteRule (.*) http://google.com  [R=301,L]
Allow from 127.0.0.1
Allow from 89.32.93.99
RewriteRule index.php$ /otherfolder [R=301,L]
我正在尝试将所有请求重定向到一个新文件夹,但由于某些原因,上面的操作不起作用

我也试过了

Redirect 301 / /otherfolder
但这只是一次又一次地将其他文件夹添加到我的域中,就像这样

mydomain.com/otherfolder/otherfolder/.....

谢谢

遵守以下规则:

Deny from all
Allow from 127.0.0.1
Allow from 89.32.93.99

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(index\.php)?$ /otherfolder [NC,R=301,L]
^(index\.php)$
将匹配URL中的
/
/index.php