我想更改我的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]
答案 0 :(得分:0)
在RewriteBase /
下面添加此内容:
RewriteCond %{THE_REQUEST} \ /+index\.php(\ |\?route=common/home|$)
RewriteRule ^ /? [L,R=301]