The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

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

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. Redirect

    Redirect

    Technical SEO Issues
    9 3 958
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • petrakraft
      petrakraft last edited by

      How do I redirect this url:

      http://www.example.com/img/head/beauty-spa.jpg" width="114" height="50" alt="image"/></a> </div> <div class="c0 r"><a href="/m/imgres?q=short+holiday+treatments

      Thank you for your help.

      1 Reply Last reply Reply Quote 0
      • scanlin
        scanlin last edited by

        Normally redirects are done in the .htaccess file of your site, using a RewriteRule. Something like this:

        RewriteEngine on
        RewriteRule ^old.html$ new.html

        Google it and you'll find more examples.

        petrakraft 1 Reply Last reply Reply Quote 0
        • petrakraft
          petrakraft @scanlin last edited by

          Hi Mike - I know this already ;-).

          I am asking for that special case.

          But thank you for your time.

          scanlin petrakraft KeriMorgret 6 Replies Last reply Reply Quote 0
          • scanlin
            scanlin @petrakraft last edited by

            the sample code you posted comes through as a whole code fragment with unpaired tags. If you post it between curly braces it should show up better here. Are you looking for the syntax of the regular expression for your case, or something else?

            1 Reply Last reply Reply Quote 0
            • petrakraft
              petrakraft @petrakraft last edited by

              Right .. sorry:

              ~img/head/beauty-spa.jpg%22%20width=%22114%22%20height=%2250%22%20alt=%22image%22/%3E%3C/a%3E%20%3C/div%3E%20%3Cdiv%20class=%22c0%20r%22%3E%3Ca%20href=%22/m/imgres?q=short+holiday+treatments~

              I am looking for something like that:

              RewriteRule ^img/head/beauty-spa.jpg(.)$ / [R=301,L]
              RewriteCond %{QUERY_STRING} ^q=short+holiday+treatments$
              RewriteRule (.
              ) /? [R=301,L]

              But it ain't work

              1 Reply Last reply Reply Quote 0
              • scanlin
                scanlin @petrakraft last edited by

                So I think you are trying to redirect a query parameter request to your home page, right? So that this:

                /m/imgres?q=short+holiday+treatments

                is redirected to this:

                /

                Correct? If so, try this:

                RewriteCond %{QUERY_STRING} ^(.)short+holiday+treatments(.)$
                RewriteRule ^(.*)$ /? [R=301,L]

                1 Reply Last reply Reply Quote 1
                • KeriMorgret
                  KeriMorgret @petrakraft last edited by

                  Petra, did this work for you?

                  Keri [SEOmoz associate]

                  1 Reply Last reply Reply Quote 0
                  • petrakraft
                    petrakraft @petrakraft last edited by

                    Hi Mike, sorry for my delayed answer (I have been on holiday in between an this means always busy time before and after... and this item was not the most important one. The problem with my mentioned redirect above has been that it worked, BUT the image itself (which is of course in use on the website) was not visible any more.

                    And your solution works perfect - I just tried it out. Thank you 🙂

                    1 Reply Last reply Reply Quote 0
                    • petrakraft
                      petrakraft @petrakraft last edited by

                      Hi Keri, you just pushed me to go forward with that problem. Yes, Mike's suggestion works perfect!

                      1 Reply Last reply Reply Quote 1
                      • 1 / 1
                      • First post
                        Last post
                      • Redirection chain and Javascript Redirect
                        0
                        1
                        19

                      • Redirect a 301 Redirect
                        RedCaffeine
                        RedCaffeine
                        0
                        5
                        98

                      • Delete 301 redirected pages from server after redirect is in place?
                        RuthBurrReedy
                        RuthBurrReedy
                        0
                        5
                        4.0k

                      • Redirects
                        MikeTek
                        MikeTek
                        0
                        3
                        357

                      • Do search engines treat 307 redirects differently from 302 redirects?
                        CarsProduction
                        CarsProduction
                        0
                        3
                        710

                      • Google Webmaster redirect vs 301 redirect
                        lavellester
                        lavellester
                        0
                        2
                        493

                      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
                      • Digital Marketers
                      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 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                      • Accessibility
                      • Terms of Use
                      • Privacy