Apache htacces重写url-从url中删除文件夹名称

Apache htacces重写url-从url中删除文件夹名称,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我正在尝试为这种情况重写htaccess url: www.website.com/index.php/admin/something => www.website.com/admin/something www.website.com/index.php/website/something => www.website.com/something www.website.com/index.php/login/something => www.website.com/logi

我正在尝试为这种情况重写htaccess url:

www.website.com/index.php/admin/something => www.website.com/admin/something
www.website.com/index.php/website/something => www.website.com/something
www.website.com/index.php/login/something => www.website.com/login/something
注意:某物可以是某物1/某物2/某物3或某物1/某物2或某物

我可以使用以下工具剪切index.php:

RewriteEngine on

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

但是我找不到一种方法来只删除网站/而不删除管理员/和登录/留下url的其余部分。

如果采用这种方法,您可能必须指定不应映射到“网站”控制器的每个可能输入引用,并将其重新映射到index.php/$1,并将其他每个请求视为网站的一种方法控制器,将其映射到index.php/website/$1

类似于下面的内容会将以admin或login开头的任何内容映射到index.php,以及其他所有内容映射到网站控制器:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^admin.*
RewriteCond %{REQUEST_URI} ^login.*
RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI}
RewriteRule ^(.*)$ /index.php?/website/$1 [L]

谢谢你的回复,但是我收到了一个500错误的所有网页与此代码。。。我正试图找到一个解决方案:在RewriteCond$1上重写引擎^网站/RewriteCond%{REQUEST_FILENAME}-f RewriteCond%{REQUEST_FILENAME}-重写规则^.*$website/$1[L]重写第二个$1^index./php | resources | robots.txt RewriteCond%{REQUEST_FILENAME}-f RewriteCond%{REQUEST_FILENAME}-重写规则^.*$index.php/$1[L]在本例中,我认为/website的所有功能都很好,但不适合管理员/或登录/