undefined
Skip to content
Moz logo Menu open Menu close
  • Products
    • Moz Pro
    • Moz Pro Home
    • Moz Local
    • Moz Local Home
    • STAT
    • Moz API
    • Moz API Home
    • Compare SEO Products
    • Moz Data
  • Free SEO Tools
    • Domain Analysis
    • Keyword Explorer
    • Link Explorer
    • Competitive Research
    • MozBar
    • More Free SEO Tools
  • Learn SEO
    • Beginner's Guide to SEO
    • SEO Learning Center
    • Moz Academy
    • MozCon
    • Webinars, Whitepapers, & Guides
  • Blog
  • Why Moz
    • Digital Marketers
    • Agency Solutions
    • Enterprise Solutions
    • Small Business Solutions
    • The Moz Story
    • New Releases
  • Log in
  • Log out
  • Products
    • Moz Pro

      Your all-in-one suite of SEO essentials.

    • Moz Local

      Raise your local SEO visibility with complete local SEO management.

    • STAT

      SERP tracking and analytics for enterprise SEO experts.

    • Moz API

      Power your SEO with our index of over 44 trillion links.

    • Compare SEO Products

      See which Moz SEO solution best meets your business needs.

    • Moz Data

      Power your SEO strategy & AI models with custom data solutions.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Free SEO Tools
    • Domain Analysis

      Get top competitive SEO metrics like DA, top pages and more.

    • Keyword Explorer

      Find traffic-driving keywords with our 1.25 billion+ keyword index.

    • Link Explorer

      Explore over 40 trillion links for powerful backlink data.

    • Competitive Research

      Uncover valuable insights on your organic search competitors.

    • MozBar

      See top SEO metrics for free as you browse the web.

    • More Free SEO Tools

      Explore all the free SEO tools Moz has to offer.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Learn SEO
    • Beginner's Guide to SEO

      The #1 most popular introduction to SEO, trusted by millions.

    • SEO Learning Center

      Broaden your knowledge with SEO resources for all skill levels.

    • On-Demand Webinars

      Learn modern SEO best practices from industry experts.

    • How-To Guides

      Step-by-step guides to search success from the authority on SEO.

    • Moz Academy

      Upskill and get certified with on-demand courses & certifications.

    • MozCon

      Save on Early Bird tickets and join us in London or New York City

    Unlock flexible pricing & new endpoints
    Moz API

    Unlock flexible pricing & new endpoints

    Find your plan
  • Blog
  • Why Moz
    • Digital Marketers

      Simplify SEO tasks to save time and grow your traffic.

    • Small Business Solutions

      Uncover insights to make smarter marketing decisions in less time.

    • Agency Solutions

      Earn & keep valuable clients with unparalleled data & insights.

    • Enterprise Solutions

      Gain a competitive edge in the ever-changing world of search.

    • The Moz Story

      Moz was the first & remains the most trusted SEO company.

    • New Releases

      Get the scoop on the latest and greatest from Moz.

    Surface actionable competitive intel
    New Feature

    Surface actionable competitive intel

    Learn More
  • Log in
    • Moz Pro
    • Moz Local
    • Moz Local Dashboard
    • Moz API
    • Moz API Dashboard
    • Moz Academy
  • Avatar
    • Moz Home
    • Notifications
    • Account & Billing
    • Manage Users
    • Community Profile
    • My Q&A
    • My Videos
    • Log Out

The Moz Q&A Forum

  • Forum
  • Questions
  • Users
  • Ask the Community

Welcome to the Q&A Forum

Browse the forum for helpful insights and fresh discussions about all things SEO.

  1. Home
  2. Digital Marketing
  3. Web Design
  4. Display a message after 301 redirect.

Moz Q&A is closed.

After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

Display a message after 301 redirect.

Web Design
2
5
3.1k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as question
Log in to reply
This topic has been deleted. Only users with question management privileges can see it.
  • WilliamBay
    WilliamBay last edited by Feb 11, 2012, 12:30 AM

    I know this one is a little more technical than pure SEO, but it somewhat ties in.

    I'm redirecting 2 sites to one. The companies have combined, and I've imported all their content that has been created, and the url mapping is set up correctly.

    So it currently is set up like this:

    A.com --> C.com
    A.com/blogpost-1 --> C.com/blogpost-1

    B.com --> C.com B.com/blogpost-20 --> C.com/blogpost-20

    What i would like is some method a redirect when landing at C.com or C.com/blogpost-XX.

    And in turn display a message in a DIV so I can style it.

    And yes, I have nothing better to do on a Friday night 🙂

    1 Reply Last reply Reply Quote 0
    • JoshPugh
      JoshPugh @WilliamBay last edited by Feb 11, 2012, 8:51 PM Feb 11, 2012, 8:42 PM

      Ah sorry about missing the bracket.

      Yeah the ? query has to come at the very end, otherwise it interrupts the flow of the URL... So it should be C.com/blogpost-20?redirect=true

      There is lots you can do, but I understand that it may be a bit more work than you planned 🙂

      1 Reply Last reply Reply Quote 1
      • WilliamBay
        WilliamBay @JoshPugh last edited by Feb 11, 2012, 8:32 PM Feb 11, 2012, 8:32 PM

        Thanks for this! It wasn't working for me initially, and asked around. looks like you missed a "]" in the first line. So it should be:

        if(isset($_GET['redirect'])){

        I was able to get it to work at the root domain. A.com --> C.com

        After getting this all sorted out though, I realize that I really wanted a pop up screen that could be closed, and that it would require me to spend even more time on it, and trying to add javascript as well. I decided to just scrap the idea.

        Another problem I had was that the ?redirect=true at the end of the URL, messed up the direct linking to subpages and posts as well. So instead of :

        C.com/blogpost-20 I would get C.com?redirect=true/blogpost-20.

        Since there is no such page, it just returned the contents from the home page.

        I appreciate your help though. It just seems like more effort that I want to put in, and probably more than the client wants to pay for.

        JoshPugh 1 Reply Last reply Feb 11, 2012, 8:42 PM Reply Quote 0
        • JoshPugh
          JoshPugh last edited by Feb 11, 2012, 10:50 AM Feb 11, 2012, 10:50 AM

          P.S. Ensure that you have rel="canonical" on the new URL because otherwise you won't be getting proper SEO for the pages with the ?redirect=true

          🙂

          1 Reply Last reply Reply Quote 0
          • JoshPugh
            JoshPugh last edited by Feb 11, 2012, 8:51 PM Feb 11, 2012, 10:49 AM

            Hi William,

            Shouldn't be too hard. In that 301 redirect, add a GET query.

            i.e. A question mark after the URL in the redirect that says something like:

            http://www.new-url.com?redirect=true

            What this will mean is that on your NEW site, you can add a query like (if using PHP):

            if(isset($_GET['redirect')){

            if($_GET['redirect'] == 'true'){

            ?>

            You were redirected!

            }

            }

            Decoding this, it basically checks for a question mark in the url, and if it finds one, it adds the div with the class "redirected" and says something!

            Let me know if that didn't make sense!

            WilliamBay 1 Reply Last reply Feb 11, 2012, 8:32 PM Reply Quote 1
            • 1 / 1
            1 out of 5
            • First post
              1/5
              Last post

            Got a burning SEO question?

            Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


            Start my free trial


            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.

            • See all categories

            Related Questions

            • KendallHershey

              How do elements that are displayed when scrolled impact SEO?

              Hi, We are wanting to implement Animate.css and Wowjs on our site and were concerned about the SEO impacts. Basically when the page is loaded, if the element is not within the viewport then the HTML tag (i.e. div tag) have a style="visibility: hidden" and once the element is within the viewport it will change to have style="visibility: visible". Would having the style="visibility: hidden" negatively impact SEO?

              Web Design | Nov 29, 2017, 4:12 PM | KendallHershey
              0
            • eLab_London

              302 redirects, canonicalise or redirect (301)?

              Hey Guys, I am fairly new to 'technical' SEO as I was lucky enough in my old role to have technical expertise in the team for things like this, now I am learning myself and it is a slow and painful process, so your expertise is soooo much appreciated! My I.T. dept say that I have 3 instances on my website where the Hybris platform is creating a 302 redirect automatically - the first: URL doesn't exist - Hybris creates a temp 302 - the system does not create case sensitive url's | http://www.example.fr/Example/Marques/0180/brand/CHANEL | URL doesn't exist | TRUE | 302 | | http://www.example.fr/Example/Marques/0015/brand/Giorgio-Armani | URL doesn't exist | TRUE | 302 |
              | http://www.example.fr/fr/Example/marken/0507/brand/lancome | URL doesn't exist | TRUE | 302 | I believe these are being redirected due to the fact that capital letters are being created in the url. Multi-lingual redirects I have a German and French version of my site and whenever any switches from one URL to the other using our language selector a 302 is created. Dynamic URL elements Dynamic url elements and special characters are being created in the URL, I am not sure where this is happening, but my I.T. department would like me to go and see whether this is something that can be created by a browser. If anyone has any similar problems or have any advice or insights even, I would love to hear from you! Thanks 🙂

              Web Design | Jun 17, 2015, 5:20 AM | eLab_London
              0
            • CamiloSC

              Website Redesign - What to do with old 301 URLs?

              My current site is on wordpress. We are currently designing a new wordpress site, with the same URLs. Our current approach is to go into the server, delete the current website files and ad the new website files. My current site has old urls which are 301 redirected to current urls. Here is my question.  In the current redesign process, do i need to create pages for old the 301 redirected urls so that we do not lose them in the launch of the new site? or is the 301 command currently existing outside of our server so this does not matter? Thank you in advance.

              Web Design | Jun 8, 2015, 1:26 PM | CamiloSC
              0
            • Discountvc

              301 Redirect all pictures when moving to a new site?

              We have 30,000 pictures on our site. Moz will return 404's on some occasionally, but Google seems to ignore those. Should I 301 redirect all those images when we move to a new site lay-out? Appreciate your views!

              Web Design | May 14, 2015, 12:44 PM | Discountvc
              0
            • Small_Business_SEO

              Do I need to 301 redirect www.domain.com/index.html to www.domain.com/ ?

              So, interestingly enough, the Moz crawler picked up my index.html file (homepage) and reported duplicate content, of course. But, Google hasn't seemed to index the www.domain.com/index.html version of my homepage, just the www.domain.com version. However, it looks like I do have links going specifically to www.domain.com/index.html and I want to make sure those are getting counted towards my overall domain strength. Is it necessary to 301 redirect in the scenario described above?

              Web Design | Jun 16, 2015, 7:36 AM | Small_Business_SEO
              0
            • soobumim

              Wordpress - redirecting tags

              I just ran a webmaster tool from Yoast SEO premium and notice I have a lot of problems with tags (restricted-robots-txt) For example : http://www.soobumimphotography.com/tag/wedding-group-photo/ Do I have to redirect to http://www.soobumimphotography.com/wedding-group-photo/ Should I do this to each and every posts Thank you

              Web Design | Mar 28, 2014, 8:42 AM | soobumim
              0
            • Will_Craig

              Is it better to redirect a url or set up a landing page for a new site?

              Hi, One of our clients has got a new website but is still getting quite a lot of traffic to her old site which has a page authority of 30 on the home page and has about 20 external backlinks. It's on a different hosting package so a different C block but I was wondering if anyone could advise if it would be better to simply redirect this page to the new site or set up a landing page on this domain simply saying "Site has moved, you can now find us here..." sort of idea. Any advice would be much appreciated Thanks

              Web Design | Mar 7, 2013, 1:45 PM | Will_Craig
              0
            • jmansd

              Is it necessary to redirect every Error page (404 or 500) found?

              If I have Hundreds of pages with 404 and 500 erros should set up 301 redirects for all of them?  Some of the pages have external links, some don't.

              Web Design | Jun 13, 2011, 7:05 PM | jmansd
              0

            Get started with Moz Pro!

            Unlock the power of advanced SEO tools and data-driven insights.

            Start my free trial
            Products
            • Moz Pro
            • Moz Local
            • Moz API
            • Moz Data
            • STAT
            • Product Updates
            Moz Solutions
            • SMB Solutions
            • Agency Solutions
            • Enterprise Solutions
            Free SEO Tools
            • Domain Authority Checker
            • Link Explorer
            • Keyword Explorer
            • Competitive Research
            • Brand Authority Checker
            • Local Citation Checker
            • MozBar Extension
            • MozCast
            Resources
            • Blog
            • SEO Learning Center
            • Help Hub
            • Beginner's Guide to SEO
            • How-to Guides
            • Moz Academy
            • API Docs
            About Moz
            • About
            • Team
            • Careers
            • Contact
            Why Moz
            • Case Studies
            • Testimonials
            Get Involved
            • Become an Affiliate
            • MozCon
            • Webinars
            • Practical Marketer Series
            • MozPod
            Connect with us

            Contact the Help team

            Join our newsletter
            Moz logo
            © 2021 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
            • Accessibility
            • Terms of Use
            • Privacy

            Looks like your connection to Moz was lost, please wait while we try to reconnect.