如何撤消301永久重定向的影响,并使域再次指向原始子域? [英] How do I undo the effects of a 301 permanent redirect, and get the domain to point at the original subdomain again?

查看:113
本文介绍了如何撤消301永久重定向的影响,并使域再次指向原始子域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我犯了一个严重错误,我似乎无法撤消它!

I've made a grave error, and I cannot seem to undo it!

一个客户突然想要一个网站(被搁置)尽快上线. 解决简单的问题,我只是删除了cPanel中的重定向.或者我以为... 然后我看到,该特定站点的重定向是对另一个域上通用404站点的301永久重定向. 注意:我们有经销商解决方案,并且在同一cPanel中将多个站点作为子域托管.

A customer all the sudden wanted a website (that was on hold) to go online asap. Easy problem to solve, I just remove the redirect in cPanel. Or so I thought... Then I saw, that the redirect for that particular site was a 301 permanent redirect, to a generic 404 site on another domain. Note: We have a reseller solution, and host several sites as subdomains in the same cPanel.

我删除了cPanel中的重定向,但该站点仍重定向到另一个域.我等了一个小时,然后是2-但没有成功.

I deleted the redirect in cPanel, but the site still redirects to the other domain. I waited and hour, then 2 - but no success.

仅主网址被重定向: customersite.dk-> developer-dd.dk/404

子页面正常工作: customersite.dk/subpage/

然后我等不及了,我在cPanel中创建了一个新的302重定向,将 customersite.dk 重定向到 customersite.dk/fakefrontpage/ 这样做是有效的,因为利用了这一事实,子页面可以正常工作,但是我认为这是一个临时解决方法,直到我已经解决了真正的问题.

Then I could not wait anymore, and I created a new 302 redirect in cPanel, redirecting the customersite.dk to customersite.dk/fakefrontpage/ This works, since it takes advantage of the fact, that subpages work allright, but I see it as a temporary workaround, 'till I've fixed the real issue.

我认为/希望与此相关的一个问题是,facebook共享调试器似乎无法获取该站点.因此,客户无法通过图像,标题和元文本在社交网站上共享该网站.

A problem, that I think/hope is related to this is, that facebook sharing debugger can't seem to fetch the site. Thus, the customer can't share the site on social with images, title and meta-text.

我该怎么办? 如何撤消已经使用了几个月的301重定向的影响? 如果实际上是问题所在? 它也有SEO分叉吗?

What do I do? How do I undo the effect of the 301 redirect, that have been in place for several months? If that is in fact the issue? Does it have SEO ramifications too?

我将.htaccess文件粘贴到此处:(我用 customersite 替换了真实网址)

I'm pasting the .htaccess file here: (I've replaced the real url with customersite)

# BEGIN LSCACHE
# END LSCACHE
# BEGIN NON_LSCACHE
# END NON_LSCACHE
#This Apache config file was created by Duplicator Installer on 2020-03-11 15:31:23.
#The original can be found in archived file with the name .htaccess__[HASH]
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
# BEGIN ShortPixelWebp
# The directives (lines) between `BEGIN ShortPixelWebp` and `END ShortPixelWebp` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
  RewriteEngine On
  ##### TRY FIRST the file appended with .webp (ex. test.jpg.webp) #####
  # Does browser explicitly support webp?
  # OR Is request from Page Speed
  # OR does this browser explicitly support webp
  # AND NOT MS EDGE 42/17 - doesnt work.
  # AND is the request a jpg or png?
  # AND does a .ext.webp image exist?
  # THEN send the webp image and set the env var webp
  RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
  RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
  RewriteCond %{HTTP_ACCEPT} image/webp
  RewriteCond %{HTTP_USER_AGENT} !Edge/17
  RewriteCond %{REQUEST_URI} ^(.+)\.(?:jpe?g|png)$
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.webp -f
  RewriteRule ^(.+)$ $1.webp [NC,T=image/webp,E=webp,L]
  ##### IF NOT, try the file with replaced extension (test.webp) #####
  # AND is the request a jpg or png? (also grab the basepath %1 to match in the next rule)
  # AND does a .ext.webp image exist?
  # THEN send the webp image and set the env var webp
  RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
  RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
  RewriteCond %{HTTP_ACCEPT} image/webp
  RewriteCond %{HTTP_USER_AGENT} !Edge/17
  RewriteCond %{REQUEST_URI} ^(.+)\.(?:jpe?g|png)$
  RewriteCond %{DOCUMENT_ROOT}/%1.webp -f
  RewriteRule (.+)\.(?:jpe?g|png)$ $1.webp [NC,T=image/webp,E=webp,L]
</IfModule>
<IfModule mod_headers.c>
  # If REDIRECT_webp env var exists, append Accept to the Vary header
  Header append Vary Accept env=REDIRECT_webp
</IfModule>
<IfModule mod_mime.c>
  AddType image/webp .webp
</IfModule>

# END ShortPixelWebp
# php -- BEGIN cPanel-generated handler, do not edit
# Set the "ea-php70" package as the default "PHP" programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php70 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
RewriteCond %{HTTP_HOST} ^customersite\.dk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.customersite\.dk$
RewriteRule ^/?$ "https\:\/\/customersite\.dk\/fakefrontpage\/" [R=302,L]

推荐答案

您应始终使用302重定向进行测试.切勿在生产服务器上使用301重定向进行测试.除了清除缓存,别无其他方法.使用重定向规则时,请记住这一点.

You should always test with a 302 redirect. Never test with 301 redirect on a production server. There no other way than clearing the cache. Please keep this in mind when playing with redirect rules.

警告:如果您确实使用301重定向,并且有许多用户访问您的网站.您必须礼貌地要求他们在重定向到达的页面上清除其缓存.

Warning: If you do use 301 redirect and if many users visit your website. You must politely ask them to clear their cache in the page where the redirect lands on.

从先前网站删除301重定向的信用 @FluffyKitten

Credits to Remove a 301 redirect from previous website and to @FluffyKitten

这篇关于如何撤消301永久重定向的影响,并使域再次指向原始子域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆