我已经将所有内容从旧网站移动到新网站,现在我想301将所有网页从旧网站重定向到新网站,具有相同的URL。Index.php?在301重定向
实施例:
http://www.oldsite.net/en/newspage.html
到http://www.newsite.com/en/newspage.html
http://www.oldsite.net/en/aboutus.html
到http://www.newsite.com/en/about.html
Thsi是我.htaccess
:
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{HTTP_HOST} ^www\.olddoamin\.net$ [NC]
RewriteRule ^(.*)$ https://www.newdomain.com/$1 [R=301,L]
而这种重定向新的网站在同一页上的所有网页,
但新的网站重定向后,在URL index.php?
。例如:
http://www.newsite.com/index.php?/en/about.html
网站是在codeigniter中开发的。
任何人都有一个想法,为什么发生这种情况?
什么是你的'$ config ['index_page']'值? – Nawin
$ config ['index_page'] =''; –
只需将'.htaccess'的最后两行移动到顶部或正下方'RewriteEngine On'行即可。 – anubhava