How can I redirect old URLs to new ones?
-
We are trying to optimize our website for search engines and one of the things we have noticed that needs to be changed are the URLs. I know how to modify the URLs but have no idea how I can get the old redirected to the new ones using 301. We have some pages ranking pretty high on Google and we can't loose this traffic.
Our website is hosted on Plesk and it was coded using Cold Fusion. I do have access to the .htaccess file.
Any help would be highly appreciated.
-
Don't forget to escape your hyphens (all of them!) with backslashes:
^pvc-cosmetic-bag-1.html
You will need to escape them before white too:
---white
-
As this URL in particular had a .html extension I thought it was easier to just create a html file and redirect it, so this one is working. But I still would like to know if i had done anything wrong because it didn't work. As most of our URLs don't have a .html extension it would be helpful to create the redirects on .htaccess
-
I just created a .html file for one of the URLs that had this extension thought the system doesn't generate htmls and it worked! Now I need to find a solution to the URLs that don't have an extension...
-
Hi, thanks for your help. The problem with this is that I don't have access to individual pages, the system will load it from the database. I think a .htaccess redirect would be the best solution, the problem is that I don't really know how to do it and how to write a redirect that would work.
Best regards
-
I have tried it but still no luck, I might have done something wrong though.
I need to urgently redirect http://www.personal-products.co.uk/pvc-cosmetic-bag-1.html to http://personal-products.co.uk/resealable-cosmetic-bags---white (I will change this URL in the future too but need it working now...)
I have tried it like this:
RewriteRule ^pvc-cosmetic-bag-1.html /resealable-cosmetic-bags---white [R=301,L]
Is there anything wrong?
Thanks!
-
Hi
maybe this article can help: http://www.quackit.com/coldfusion/tutorial/coldfusion_redirect.cfm
In ColdFusion, redirects can be done via one of two methods. The method you use will depend on the reason for the redirect.
Temporary Redirects (cflocation)
This is the most commonly used of the two - you will probably find yourself using the cflocation tag often.
A temporary redirect is typically used when you need to redirect the user to another page based on some logical rule in your program. For example, straight after they submit a form, the browser might redirect to another page.
ColdFusion includes the cflocation tag for performing temporary redirects. This actually sends HTTP headers to the user's browser indicating a 302 status code, which means "Moved Temporarily".
<cflocation url="/new_location.cfm"></cflocation>
Permanent Redirects
A permanent redirect should be used when a page no longer exists.
Permanent redirects use the 301 HTTP status code, which means, "Moved Permanently". In ColdFusion, a permanent redirect can be achieved using the cfheader tag.
<cfheader statuscode="301" statustext="Moved Permanently"><cfheader name="Location" value="http://www.quackit.com/coldfusion/tutorial"><cfabort></cfabort></cfheader></cfheader>
In case you're thinking, "but users can't see the status code anyway", that's only partially true. The 301 status code can be very useful for search engines. They will actually take notice of your 301 status code and index the correct file.
-
You could try something like this:
RewriteRule ^overnight-toiletry-packs.html /toiletry-travel-bags [R=301,L]
You need to escape the hyphens and periods... and include the switches for the 301 and specify that it's the Last rule.
Let me know how that goes - certainly share some code if you still get stuck.
-John
-
Thanks for your help!
The example would be the same as the one above, do you know what is the best way to do it??
http://personal-products.co.uk/overnight-toiletry-packs.html -> our current url
we have optimized this page to "toiletry travel bags" so i want the url to look something like this:
-
Thanks.. I got that far, but I tried few different 301 redirects and it didn't work.
One example would be this:
http://personal-products.co.uk/overnight-toiletry-packs.html -> our current url
we have optimized this page to "toiletry travel bags" so i want the url to look something like this:
http://personal-products.co.uk/toiletry-travel-bags
I can change the URL manually but I need to create a 301 redirect. Do you have any idea how I can do it? As we use a coldfusion website, the pages don't actually exist, they are all on the database.
i had tried few methods I found on google but no luck =[
-
Hey Flavia-
Check out this article on htaccess magic
http://www.askapache.com/htaccess/list-of-methods-to-redirect-users-to-different-page.html
There is a section on 301 redirects that will get you started. If you want to share any specific examples I'd be happy to help you further.
-John
-
You can do 301 redirects from the old page to the new page using .htaccess..however I would suggest you test the impact by doing it for 1-2 urls first and see if it does indeed help. The reason I am suggesting this is because when you do 301 redirects or canonical urls which also act like 301s, there's a little bit of link juice loss from the old URL. S if you have lots of websites linking to that page, you may loose a little bit of that link juice. Again, you have to do more of a risk/reward analysis and see what makes sense.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Google is still indexing the old domain a year after 301 redirects are put in place
Hi there, You might have experienced this before but for me this is the first. A client of mine moved from domain A (www.domainA.com) to domain B (www.domainB.com). 301 redirects are all in place for over a year. But the old domain is still showing in Google when you search for "site:domainA.com" The HTTP Header check shows this result for the URL https://www.domainA.com/company/cookie-policy.aspx HTTP/1.1 301 Moved Permanently =>
Technical SEO | | iQi
Cache-Control => private
Content-Length => 174
Content-Type => text/html; charset=utf-8
Location => https://www.domain_B_.com/legal/cookie-policy
Server => Microsoft-IIS/10.0
X-AspNetMvc-Version => 5.2
X-AspNet-Version => 4.0.30319
X-Powered-By => ASP.NET
Date => Fri, 15 Mar 2019 12:01:33 GMT
Connection => close Does the redirect look wrong? The change of address request was made on Google Console when the website was moved over a year ago. Edit: Checked the domainA.com on bing and it seems that its not indexed, and replaced with domainB.com, which is the right. Just Google is indexing the old domain! Please let me know your thoughts on why this is happening. Best,0 -
Is a short URL path stronger than a long one for an eshop?
Hello Moz Fans ! I'm building an eshop website and reviewing a few competitors website I found something interesting on which I don't have the full answer. Will it be better for me to organize the products in sub folder or in the root folder (option 1 or option 2) _Competitor link _shop.com/en/2628-buy-key-origin-the-sims-4-seasons/ Option 1 - Normal organization _+ _We can add relevant KW in /products/ product url will be one folder deep more home/ home/category/ (category page) home/category/subcategory1 home/category/subcategory2 home/products (this page does not exist really) home/products/product1 home/products/product2 Option 2 - less folders _+ _We can add all KW in the link directly it may be less organize for Google home/ home/category/ (category page) home/category/subcategory1 home/category/subcategory2 home/product1 (all product in the direct folders) home/product2
Technical SEO | | kh-priyam0 -
Use existing page with bad URL or brand new URL?
Hello, We will be updating an existing page with more helpful information with the goal of reaching more potential customers through SEO and also attaching a SEM campaign to the specific landing page. The current URL of the page scores 25 on Page Authority, and has 2 links to it from blog articles (PA 35, 31). The current content needs to be rewritten to be more helpful and also needs some additional information. The downsides are that it has an "bad" URL- no target keyword and uses underscores. Which of the following choices would you make? 1. Update this old "bad" URL with new content. Benefit from the existing PA. -or- 2. Start with a new optimized URL, reusing some of the old content and utilizing a 301 redirect from the previous page? Thank you!
Technical SEO | | XLMarketing0 -
One server, two domains - robots.txt allow for one domain but not other?
Hello, I would like to create a single server with two domains pointing to it. Ex: domain1.com -> myserver.com/ domain2.com -> myserver.com/subfolder. The goal is to create two separate sites on one server. I would like the second domain ( /subfolder) to be fully indexed / SEO friendly and have the robots txt file allow search bots to crawl. However, the first domain (server root) I would like to keep non-indexed, and the robots.txt file disallowing any bots / indexing. Does anyone have any suggestions for the best way to tackle this one? Thanks!
Technical SEO | | Dave1000 -
New domain's Sitemap.xml file loaded to old domain - how does this effect SEO?
I have a client who recently changed their domain when they redesigned their site. The client wanted the old site to remain live for existing customers with links to the new domain. I guess as a workaround, the developer loaded the new domain's sitemap.xml file to the old domain. What SEO ramifications would this have if any on the primary (new) domain?
Technical SEO | | julesae0 -
I physically changed my URL and now I have two...How do I get rid of the old one?
Hi, I physically changed my URL as something else and now Google thinks I have two duplicate pages (I know not to do this in the future). e.g. I had www.example.com/i-like-seo.aspx and changed it to: www.example.com/i-love-seo.aspx Google sees this as two pages now and my CMS system is only showing one page (The new page) Also, SEOMOZ is seeing two pages and further more sees them both as having two different amounts of inbound links? When I change content on the new url page, the old url page also updates. I'm really confused as to what has happened here and don't know how to get rid of the old url so that Google doesn't think that I have duplicate content. Any help to what has happened or how to fix it would be so helpful and appreciated. Many thanks.
Technical SEO | | CoGri0 -
301 redirects & merging two sites into one
We have a client that has two sites that rank well for different searches in their market. The main pages ranking are things like advice articles and news pieces. For various reasons, they just want one site. I believe they need to duplicate the content from the outgoing site and place it on the main site, with a 301 redirect from each old page to each new one. What happens when they eventually want to redirect the entire domain? Would these smaller, internal redirects become obsolete, therefore removing any link value they once had? I am not sure how this works or if there is a best practice way to do this. Thanks Gareth
Technical SEO | | Gmorgan0 -
Changed cms - google indexes old and new pages
Hello again, after posting below problem I have received this answer and changed sitemap name Still I receive many duplicate titles and metas as google still compares old urls to new ones and sees duplicate title and description.... we have redirectged all pages properly we have change sitemap name and new sitemap is listed in webmastertools - old sitemap includes ONLY new sitemap files.... When you deleted the old sitemap and created a new one, did you use the same sitemap xml filename? They will still try to crawl old URLs that were in your previous sitemap (even if they aren't listed in the new one) until they receive a 404 response from the original sitemap. If anone can give me an idea why after 3 month google still lists the old urls I'd be more than happy thanks a lot Hello, We have changed cms for our multiple language website and redirected all odl URl's properly to new cms which is working just fine.
Technical SEO | | Tit
Right after the first crawl almost 4 weeks ago we saw in google webmaster tool and SEO MOZ that google indexes for almost every singlepage the old URL as well and the new one and sends us for this duplicate metatags.
We deleted the old sitemap and uploaded the new and thought that google then will not index the old URL's anymore. But we still see a huge amount of duplicate metatags. Does anyone know what else we can do, so google doe snot index the old url's anymore but only the new ones? Thanks so much Michelle0