You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

网站全版本301重定向求助:将elysian-store.ir跳转至.com域名

解决旧域名全变体重定向到新域名的方案

Got it, let's tackle this redirect issue properly—since you need to cover all variants (www/non-www, HTTP/HTTPS) from your old .ir domain to the new .com one, we'll go through the most common server setups and a WordPress-specific solution in case that's what you're using.

Apache服务器(.htaccess配置)

如果你的网站用的是Apache,直接在旧域名根目录的.htaccess文件里添加以下规则(如果没有就新建一个)。这些规则会先强制HTTPS,再把所有旧域名的流量(不管带不带www)永久重定向到新域名的对应路径:

# 强制HTTPS(针对旧域名)
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# 重定向所有旧域名变体到新域名(保留路径)
RewriteCond %{HTTP_HOST} ^(www\.)?elysian-store\.ir$ [NC]
RewriteRule ^(.*)$ https://elysian-store.com/$1 [L,R=301,NC]

解释:

  • [NC]表示忽略大小写,避免大小写匹配问题
  • R=301是永久重定向,对SEO最友好(告诉搜索引擎更新索引指向新域名)
  • %{REQUEST_URI}会完整保留原页面的路径,比如旧域名的/product/leather-bag会自动跳转到新域名的/product/leather-bag

如果你的新域名偏好带www的版本,把最后一行的https://elysian-store.com/$1改成https://www.elysian-store.com/$1即可。

Nginx服务器配置

如果用的是Nginx,找到旧域名的server配置块,替换或添加以下内容:

# 处理HTTP的旧域名请求
server {
    listen 80;
    server_name elysian-store.ir www.elysian-store.ir;
    return 301 https://elysian-store.com$request_uri;
}

# 处理HTTPS的旧域名请求
server {
    listen 443 ssl;
    server_name elysian-store.ir www.elysian-store.ir;

    # 这里保留旧域名的SSL证书配置(如果已部署)
    ssl_certificate /path/to/old-domain-cert.pem;
    ssl_certificate_key /path/to/old-domain-key.pem;

    return 301 https://elysian-store.com$request_uri;
}

同样,如果偏好新域名带www,把https://elysian-store.com$request_uri改成https://www.elysian-store.com$request_uri。修改后记得重启Nginx生效:sudo systemctl restart nginx。

WordPress/WooCommerce站点额外步骤

如果你的电商站是基于WordPress/WooCommerce的,除了服务器端重定向,还需要确保站点核心配置正确:

  1. 登录WordPress后台,进入设置→常规
  2. 把“WordPress地址(URL)”和“站点地址(URL)”都改成新域名(比如https://elysian-store.com)
  3. 保存设置后,建议清理网站缓存;如果有遗留的内部链接问题,也可以用Redirection插件辅助处理,但服务器端规则的效率会更高。

必做测试

一定要测试所有可能的旧域名变体,确保都能正确跳转:

  • http://elysian-store.ir
  • https://elysian-store.ir
  • http://www.elysian-store.ir
  • https://www.elysian-store.ir
  • 带具体路径的页面,比如https://elysian-store.ir/about-us,确认跳转后路径保留完整

内容的提问来源于stack exchange,提问作者Noshad70

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 09:01:31