使用htaccess将旧网址重定向到新网址打开的购物车 [英] Redirect Old URL to New URL open cart using htaccess
问题描述
我想将301旧网址重定向到新网址.
I want to redirect 301 old url to new url.
我的旧网址是
http://www.domainname.com/special
新的网址是;
http://www.domainname.com/offers
我尝试了以下代码:
redirect 301 /http://www.domainname.com/special http://www.domainname.com/offers
但是现在仍然没有重定向&带我到不存在的旧网址.
But still now it's not redirecting & taking me to the old URL which does'nt exist.
推荐答案
执行此操作的方法有多种,并且进行了各种重定向,我在下面列出了它们:
There are various ways to do this and various redirects, I've listed them below:
301(永久)重定向:将整个站点永久指向另一个URL.这是最常见的重定向类型,在大多数情况下很有用.在此示例中,我们将重定向到"example.com"域:
301 (Permanent) Redirect: Point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the "example.com" domain:
这使您可以将整个网站重定向到任何其他域
This allows you to redirect your entire website to any other domain
Redirect 301 / http://example.com/
302(临时)重定向:将整个站点指向另一个临时URL.当您有一个临时的着陆页并计划以后再切换回主着陆页时,这对于SEO很有用:
302 (Temporary) Redirect: Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date:
这使您可以将整个网站重定向到任何其他域
This allows you to redirect your entire website to any other domain
Redirect 302 / http://example.com/
将index.html重定向到特定的子文件夹:
Redirect index.html to a specific subfolder:
这允许您将index.html重定向到特定的子文件夹
This allows you to redirect index.html to a specific subfolder
Redirect /index.html http://example.com/newdirectory/
将旧文件重定向到新文件路径:
Redirect an old file to a new file path:
将旧文件路径重定向到新文件路径
Redirect old file path to new file path
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html
重定向到特定的索引页面:
Redirect to a specific index page:
提供特定索引页面(设置默认处理程序)
Provide Specific Index Page (Set the default handler)
DirectoryIndex index.html
这篇关于使用htaccess将旧网址重定向到新网址打开的购物车的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!