我怎样才能只重定向主文件

How can I redirect only main file

我的网站结构如下

site
    |-- .htaccess
    |-- index.php
    |-- other files and directories

index.php 文件用于每个重定向。我如何修改 .htaccess 仅在有人想要访问 mydomain.com 时才重定向到 mydomain.com/desiredLink 而不是当有人使用 mydomain.com/otherlinkmydomain.com/index.php?stuff 时?

当前.htaccess内容如下:

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

您可以使用:

RewriteEngine on
RewriteBase /

# redirect root URL
RewriteRule ^/?$ /desiredLink [L,R]

# other than root URL
RewriteCond  !^(index\.php|resources|assets|robots\.txt) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php/ [L]