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. .htaccess when integrating one website into another

    .htaccess when integrating one website into another

    Technical SEO Issues
    3 2 611
    • 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.
    • AndrewAkesson
      AndrewAkesson last edited by

      My client would like to integrate one of it's smaller websites into its main website.

      I've identified around 20 pages which I'd like to 301 redirect to specific pages on the main website, and this is simple enough.

      The problem I have is that I am not sure how I can then put a catch-all to redirect all other pages on the site to the homepage of the main website.

      I'd originally though something like this would work:

      redirect 301 / http://www.mainwebsite.com/ (catch-all)
      redirect 301 /about.asp http://www.mainwebsite.com/about (specific redirect 1)
      redirect 301 /latest.asp http://www.mainwebsite.com/news (specific redirect 1)
      etc.

      Any ideas?

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

        You should be able to achieve what you want by redirecting 404s. You can do this by adding the following to your .htaccess

        ErrorDocument 404 /homepage.html

        Where homepage.html is the address of your homepage.

        What would be better really though is to land them on a an actual 404 page that explains that the page doesn't exist anymore and gives them options of where to go next. Include direct links to the most popular content on the site.

        1 Reply Last reply Reply Quote 1
        • AndrewAkesson
          AndrewAkesson last edited by

          Just had a eureka moment with the issue as above!

          All that was needed was a .htaccess on the old site like this:

          Redirect 301 / http://www.newsite.com/

          This attempts to pass a user/crawler to the equivalent page on the new site (which doesn't exist), so this is then handled with a .htaccess on the new site which then redirects to the new versions of those pages:

          Redirect 301 /about.asp http://www.newwebsite.com/about (specific redirect 1) Redirect 301 /latest.asp http://www.newwebsite.com/news (specific redirect 1)

          Simples!

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          • Using one domain for email and another domain for your website, but redirects...
            GFD_Chris
            GFD_Chris
            1
            2
            27

          • Why has google stopped showing one domain and switching to showing another that points to the same website?
            AlanMosley
            AlanMosley
            0
            4
            146

          • Has anyone relocated a website from one country to another?
            MoosaHemani
            MoosaHemani
            0
            7
            83

          • Redirecting pages from a website to another
            SonicCrewLondon
            SonicCrewLondon
            0
            3
            49

          • Rewrite rules from one domain to another one
            bobrock4
            bobrock4
            0
            3
            190

          • One hosting plan for multiple websites?
            ChristopherGlaeser
            ChristopherGlaeser
            0
            2
            180

          • Moving a site from one server to another
            Bandicoot
            Bandicoot
            0
            5
            549

          • When moving my ecommerce website from one host to another should I also 301 all my image urls?
            onwebtoday
            onwebtoday
            0
            7
            3.8k

          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