301 redirects.
-
Hi everyone,
I am having some issues with an a few dynamic URLs that are not redirecting;
Example:
I first tried to carry out a standard 301 which looked like this;
Redirect 301 /longurlwith&category_id=303 http://www.example.com/new-url
Which didn't work. After a little bit of research I added the following into the htaccess file;
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]RewriteRule ^/shop-online$(.*)$ http://www.example.com/shop-online$ [NE,L,R=301]
Which caused the website to error 500 (Not cool).
So now I am stumped. Any help would be really appreciated as I'm sure it's an easy fix but I can't quite my finger on it.
Thanks in advance :).
-
Hi Adam
Yes you are correct as your query string is changing and so is the page you are directing to.
-
Hi there,
i agree with matt but it could also be that the end of the redirect tag would be [R=301,L] in stead of [L,R=301]. This depends on the server. I had it happen to me a copple of times. Makes you question a lot of things and in the end it is as simple as this.
hope this helps
Matt +1
Jarno
-
Hi Adam,
Try this:
RewriteCond %{QUERY_STRING} ^everything-after-the-question-mark$ RewriteRule ^shop-online$ http://www.new.com/new-page? [L,R=301]
so above would be
Options +FollowSymlinks RewriteEngine On
RewriteCond %{QUERY_STRING} ^page=shop.product_details&flypage=flypage_images.tpl&product_id=69164&category_id=303$ RewriteRule ^shop-online$ http://www.new.com/new-page? [L,R=301]
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
-
301 redirects and impact on page authority
I need to restructure a section of my website, changing some page titles and moving some pages to other sections. This will then change the URLs but the CMS I use will automatically create 301 redirects so the old URLs still work. The question is, will this have any negative impacts on page authority/page rank? From what I've read, it seems having 301's used to have a negative impact but doesn't anymore?
Intermediate & Advanced SEO | | ciehmoz0 -
Redirecting to Modal URLs
Hi everyone! Long time no chat - hope you're all well! I have a question that for some reason is causing me some trouble. I have a client that is creating a new website, the process was a mess and I am doing a last minute redirect file for them (long story, for another time). They have different teams for different business categories, so there are multiple staff pages with a list of staffers, and a link to their individual pages. Currently they have a structure like this for their staff bios... www.example.com/category-staff/bob-johnson/ But now, to access the staffers bio, a modal pops up. For instance... www.example.com/category-staff/#bob-johnson Should I redirect current staffers URLs to the staff category, or the modal URL? Unfortunately, we are late in the game and this is the way the bio pages are set up. Would love thoughts, thanks so much guys!!
Intermediate & Advanced SEO | | PatrickDelehanty0 -
Flip-Flopping domains - 301 redirect question
We have a client who has had the following domain setup for some time: longdomain.com 301 -> shortdomain.com Now, they would like to go back to the original longdomain.com, and will have the following setup: shortdomain.com 301 -> longdomain.com Obviously, I'm concerned about redirect loops cached in the browser. I plan to have the 301's from longdomain.com changed over to 302's for two weeks ahead of the change, so that hopefully when the change happens, browsers and search engines are more ready to respond. I also plan to establish rel=canonical on the longdomain.com pages after the switch. Is there anything else you'd recommend to help with the changeover? Should we plan for an intermediary period were both domains are serving the content, so that the redirects can be purged, before being re-established the other direction? Thanks in advance.
Intermediate & Advanced SEO | | Bit-Wizards0 -
Persistent listings or 301 redirects better for SEO?
Imagine these 2 scenarios for an ecommerce listing. 1. A listing that only closes once stock runs out 2. A listing that relists every 7 days assuming stock has run out and doing a 301 redirect to the latest version of that listing (imagine it relists several times) You might ask why on earth we would have the 2nd scenario, but we are an auction site where some listings can't be bid on. In other words those Buy Now only listings are also part of the auction model - they close after 7 days. For me it is a no-brainer that scenario 1 is better for SEO, and I have my ideas on why this is better for SEO than the second scenario such as age, SERP CTR, link equity not being diluted by 301 redirects not changing every 7 days when the listing relists multiple times etc. I was wondering if someone could articulate better than I possibly could why scenario 1 is better for SEO, and why scenario 1 would rank better in the SERPS....would it? Many thanks! Cheers, Simon
Intermediate & Advanced SEO | | sichristie0 -
How to do a site migration followed by a domain migration and avoid 301 redirect chains?
Hi all, The current roadmap for our Eng team has us performing a site migration (redirecting one subfolder to another subfolder) and then a domain migration shortly after. The way I see it, I have 2 scenarios (the 1st involves the site migration THEN the domain migration and the 2nd is the site migration and domain migration being done simultaneously): olddomain.com/subfolder-old to olddomain.com/subfolder-new THEN olddomain.com/subfolder-new to newdomain.com/subfolder-new AND olddomain.com/subfolder-old to newdomain.com/subfolder-new olddomain.com/subfolder-old to newdomain.com/subfolder-new I also understand that there are two best practices for a domain migration and they are 1) keep everything the same that you can to help Google understand it is the same page, just on a different domain and 2) avoid chain redirects. As you can imagine, scenario 1 requires more Eng costs than scenario 2. So, my question is, is scenario 2 a perfectly viable option or should I make the push to go for scenario 1? Any advice is greatly appreciated!
Intermediate & Advanced SEO | | brad-causes1 -
Canonical OR redirect
Hi, i've a site about sport which cover matches. for each match i've a page. last week there was a match between: T1 v T2 so a page was created: www.domain.com/match/T1vT2 - Page1 this week T2 host T1, so there's a new page www.domain.com/match/T2vT1 - Page2 each page has a unique content with Authorship, but the URL, Title, Description, H1 look very similar cause the only difference is T2 word before T1. though Page2 is available for a few days, on site links & sitemap, for the search query "T2 T1 match" Page1 appears on the SERP (high location). of course i want Page2 to be on SERP for the above query cause it's the relevant match. i even don't see Page2 anywhere on the SERP and i think it wasn't indexed. Questions: 1. do you think google see both pages as duplicated though the content is different? 2. is there a difference when you search for T1 vs T2 OR T2 vs T1 ? 3. should i redirect 301 Page1 to Page2? consider that all content for Page1 and the Authorship G+ will be lost. 4. should i make rel=canonical on Page1 to Page2? 5. should i let google sort it out? i know it's a long one, thanks for your patience. Thanks, Assaf
Intermediate & Advanced SEO | | stassaf0 -
Is a 301 to a 301 ok?
I have a site that has a lot of url differences. Due to coding we sometimes have to 301 to a page that is 301'd to another. Is there any danger in doing this?
Intermediate & Advanced SEO | | EcommerceSite0 -
Undo a 301 redirect
Hi there, 4 months ago I have done a redirect from one domain to another. Now, after about 120 days I have just a few results from the old domain indexed. The problem is that I believe that the old domain name had a really big impact on rankings, as it had the main keyword in the domain name. I'm wondering now if I could restore the old domain just by taking out the 301 instruction and how will search engines react. Do you have any studies on that? Would it be possible? Matt Cutts himself did it with his own domain, but he doesn't talk specifically on the effect of the rankings: http://www.thedotcomblog.com/seo/redirects-after-change-in-domain-name Thanks in advance for any help,
Intermediate & Advanced SEO | | SandraMoZ0