本文介绍了如何撤消301永久重定向的影响,并使域再次指向原始子域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我犯了一个严重错误,我似乎无法撤消它!
一个客户突然想要一个网站(被搁置)尽快上线. 解决简单的问题,我只是删除了cPanel中的重定向.或者我以为… 然后我看到,该特定站点的重定向是对另一个域上通用404站点的301永久重定向. 注意:我们有经销商解决方案,并且在同一cPanel中将多个站点作为子域托管.
我删除了cPanel中的重定向,但该站点仍重定向到另一个域.我等了一个小时,然后是2-但没有成功.
仅主网址被重定向: customersite.dk-> developer-dd.dk/404
子页面正常工作: customersite.dk/subpage/
然后我等不及了,我在cPanel中创建了一个新的302重定向,将 customersite.dk 重定向到 customersite.dk/fakefrontpage/ 这样做是有效的,因为利用了这一事实,子页面可以正常工作,但是我认为这是一个临时解决方法,直到我已经解决了真正的问题.
我认为/希望与此相关的一个问题是,facebook共享调试器似乎无法获取该站点.因此,客户无法通过图像,标题和元文本在社交网站上共享该网站.
我该怎么办? 如何撤消已经使用了几个月的301重定向的影响? 如果实际上是问题所在? 它也有SEO分叉吗?
我将.htaccess文件粘贴到此处:(我用 customersite 替换了真实网址)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# 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. RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # 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. 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] # If REDIRECT_webp env var exists, append Accept to the Vary header Header append Vary Accept env=REDIRECT_webp AddType image/webp .webp # END ShortPixelWebp # php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php70" package as the default "PHP" programming language. AddHandler application/x-httpd-ea-php70 .php .php7 .phtml # 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重定向进行测试.除了清除缓存,别无其他方法.使用重定向规则时,请记住这一点.
警告:如果您确实使用301重定向,并且有许多用户访问您的网站.您必须礼貌地要求他们在重定向到达的页面上清除其缓存.
这篇关于如何撤消301永久重定向的影响,并使域再次指向原始子域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助!
浏览量: 43