是否可以使用javascript或jQuery进行301重定向? [英] Are 301 redirects possible using javascript or jQuery?
问题描述
我正在运行Apache 2.0,我只是想知道是否有可能使用JavaScript或jQuery进行301重定向.
I'm running Apache 2.0 and I'm just wondering if it is possible to make a 301 redirect using JavaScript or jQuery.
我有一个<a></a>
标记,其中href
到了指定位置,当我单击该链接时,系统要求我进行301重定向.
I have an <a></a>
tag with href
to a specified location and I'm asked to make a 301 redirect when I click that link.
这是针对SEO的,我正在尝试找到一种方法,以使301重定向到链接中的同一页面,而不必创建新页面或创建表单/提交.
This is for SEO and I'm trying to find a way to do the 301 redirect to the same page in the link without having to create a new page or create a form/submit.
推荐答案
简而言之否.
JavaScript完全在客户端运行. 301重定向应该作为来自服务器的响应而来.这意味着没有服务器支持就无法执行此操作.
JavaScript runs entirely on the client side. 301 redirects are supposed to come as a response from the server. Which means you cannot do this without server support.
这篇关于是否可以使用javascript或jQuery进行301重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!