简体   繁体   中英

.htaccess redirect from old to new domain doesn't work

There's two Magento webshops. One at olddomain.com , the other on at newdomain.com . I'd like to redirect from whatever link related to the olddomain to the homepage of newdomain.com`.

So far, I've changed the .htaccess file in the /public_html/app folder, from

Order deny,allow
Deny from all

to

RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301,NC]

as seen in many articles out there.

I've emptied the cache, but it still doesn't work at all. What am I missing here or is my approach insufficient?

首先将您的 .htaccess 文件移动到 /public_html/ 尝试从http://www.htaccessredirect.net/生成新的 .htaccess 文件

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM