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. Intermediate & Advanced SEO
    4. 301 Redirect To Corresponding Link No Matter The URL?

    301 Redirect To Corresponding Link No Matter The URL?

    Intermediate & Advanced SEO
    3 2 797
    • 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.
    • DustinX
      DustinX last edited by

      Hey guys

      I have hosting on Host Gator with I believe an apache web server. I need a code to put in the HT ACCESS to redirect all WWW URL's to their corresponding http URL. I haven't been able to get a code to work.

      For example, http://www.mysite.org/page1.html -> http://mysite.org/page1.html , without having to redirect hundreds of pages individually

      Here is the format my server uses in the HT ACCESS file for 301 redirects.

      RewriteCond %{HTTP_HOST} ^mysite.org$ [OR] RewriteCond %{HTTP_HOST} ^www.mysite.org
      $RewriteRule ^Electric-Pressure-Cookers.html$ "http://mysite.org/Pressure-Cookers.html" [R=301,L]

      Thanks

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

        RewriteEngine On
        RewriteBase /
        RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
        RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
        

        Andy 🙂

        1 Reply Last reply Reply Quote 2
        • DustinX
          DustinX last edited by

          Hey Andy,

          Thanks a ton - now all my URL's are appearing as the http version - one problem remains, however, and that is that I can still access the WWW version. Trying to 301 all URL's to the http version but now part of the problem is fixed. Thanks a ton!

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          • URL Too Long vs. 301 Redirect
            Corbec888
            Corbec888
            0
            4
            54

          • Is 1:1 301 redirect required on indexed URL when restructing URL even if the new URL is canonicalized?
            EricaMcGillivray
            EricaMcGillivray
            0
            2
            138

          • How do you 301 redirect URLs with a hashbang (#!) format? We just lost a ton of pagerank because we thought javascript redirect was the only way! But other sites have been able to do this – examples and details inside
            JamesTDG
            JamesTDG
            0
            9
            7.9k

          • Should /node/ URLs be 301 redirect to Clean URLs
            MargaritaS
            MargaritaS
            0
            3
            172

          • Url rewrite & 301 redirects
            BlueprintMarketing
            BlueprintMarketing
            0
            4
            295

          • 301 Redirect To Another 301 Redirect
            cbielich
            cbielich
            0
            5
            247

          • How to 301 redirect all URLs with /? in?
            JohnPeters
            JohnPeters
            0
            9
            331

          • Are there any negatives to channeling my links through a 301 redirect?
            AlanMosley
            AlanMosley
            0
            4
            483

          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