简体   繁体   English

.htaccess 从旧域重定向到新域不起作用

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

There's two Magento webshops.有两个Magento网上商店。 One at olddomain.com , the other on at newdomain.com .一个在olddomain.com ,另一个在newdomain.com I'd like to redirect from whatever link related to the olddomain to the homepage of newdomain.com`.我想从与 olddomain 相关的任何链接重定向到 newdomain.com` 的主页。

So far, I've changed the .htaccess file in the /public_html/app folder, from到目前为止,我已经将/public_html/app文件夹中的.htaccess文件从

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 文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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