.htaccess htaccess opencart重复主页变体

.htaccess htaccess opencart重复主页变体,.htaccess,mod-rewrite,redirect,opencart,.htaccess,Mod Rewrite,Redirect,Opencart,我想对我的htaccess文件进行更改,以便如果有人输入mydomain.com/index.php或mydomain.com/index.php?route=common/home,它会将他们重定向到mydomain.com。我已经将我的域从www.mydoamin.com重定向到mydomain.com。下面是我在我的文件中所做的。现在我一点也不明白,但我这里有一个线程,它对我有用 RewriteCond %{HTTP_HOST} !^vineyardwine\.co.uk [NC] Rew

我想对我的htaccess文件进行更改,以便如果有人输入mydomain.com/index.php或mydomain.com/index.php?route=common/home,它会将他们重定向到mydomain.com。我已经将我的域从www.mydoamin.com重定向到mydomain.com。下面是我在我的文件中所做的。现在我一点也不明白,但我这里有一个线程,它对我有用

RewriteCond %{HTTP_HOST} !^vineyardwine\.co.uk [NC]
RewriteRule (.*) http://vineyardwine.co.uk/$1 [R=301,L]
我从不同的线程中得到了以下内容,但他们似乎没有做任何事情,任何帮助/建设性的批评都将不胜感激

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

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

将此项添加到
RewriteBase/
的正下方:

RewriteCond %{THE_REQUEST} \ /+index\.php(\ |\?route=common/home|$) 
RewriteRule ^ /? [L,R=301]

我会让其余的重写规则保持原样吗?还是可以删除它们?也只是添加这个,对于index.php来说效果很好,但是当我得到mydomain.com/index.php时?route=common/home它的重编到mydomain.com/?route=common/home@user3367840你不需要删除其他规则,只要确保这一条在你的其他规则之前。另外,我在规则的目标中遗漏了一个
。参见编辑