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 a website to mine within a subfolder

    301 a website to mine within a subfolder

    Intermediate & Advanced SEO
    4 3 326
    • 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.
    • AngelosS
      AngelosS last edited by

      Hey there Mozzers,

      I have purchased a very amazing Social Media Related Plugin. I already have a business website about digital marketing which pretty much falls in the same category.

      I am thinking of transferring that plugin into a subfolder of my own website.

      Is there anything I should keep in mind when I do that?

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

        Out of curiosity, what CMS is your site on?

        AngelosS 1 Reply Last reply Reply Quote 1
        • BlueprintMarketing
          BlueprintMarketing last edited by

          Without the CMS I will guess WordPress.

          Move to or add subfolder (if needed)

          MAKE A BACK UP I like blogvault.com , vaultpress.com & sucuri.net backups

          This url shows you it all.

          https://www.namecheap.com/support/knowledgebase/article.aspx/9495/2187/how-to-move-wordpress-from-subfolder

          for moving back to root I KNOW IT IS (mostly great tools you will need anyway) 

          http://askwpgirl.com/move-wordpress-subdirectory-root/

          https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

          use

          https://generatewp.com/wp-config/

          /* Custom WordPress URL. */
          define('WP_SITEURL','http://example.com/blog');
          define('WP_HOME','http://example.com/wordpress');
          define('WP_CONTENT_URL','http://example.com/wordpress/wp-content');
          define('UPLOADS','http://example.com/wordpress/wp-content/uploads');
          define('WP_PLUGIN_URL','http://example.com/wordpress/wp-content/plugins');
          define('COOKIE_DOMAIN','cookies.example.com');
          

          just plugins

          See: https://yoast.com/smarter-upload-handling-wp-plugins/

          add_filter('upload_dir', 'my_upload_dir');
          $upload = wp_upload_dir();
          remove_filter('upload_dir', 'my_upload_dir');
          
          funcion my_upload_dir($upload) {
          	$upload['subdir']	= '/sub-dir-to-use' . $upload['subdir'];
          	$upload['path']		= $upload['basedir'] . $upload['subdir'];
          	$upload['url']		= $upload['baseurl'] . $upload['subdir'];
          	return $upload;
          }
          

          rel=canonical and how to 301 to subfolder

          In Settings > General, change the address of your site but not the address of WordPress. For example, if you've been working on the site at example.com/development, change the settings as follows:

          • WordPress address (URL): http://example.com/development
          • Site Address (URL): http://example.com

          Click the Save changes button and move on to the next steps before trying to access your site.

          Copying the Files

          Using FTP or CPanel file manager, copy (don't move) the following files from your WordPress directory to the root directory:

          • index.php
          • .htaccess, if you have one. If there isn't an .htaccess file (and the fact that you've turned off pretty permalinks means you're less likely to have one), don't worry about creating one—just skip this step.

          Editing index.php

          Edit the index.php file that you've moved. You could do this by:

          • editing it in situ after the move, using an FTP client or cPanel file manager
          • downloading it from the subdirectory, editing it and then uploading it to the root directory—instead of making a copy

          The edit you need to make is to one line at the end of the file. Find the line that reads as follows:

          | 1 | require ('./wp-blog-header.php) |

          Change it to:

          | 1 | require ('./subdirectoryname/wp-blog-header.php) |

          So if you've been developing in example.com/development, just change the line to:

          | 1 | require ('./development/wp-blog-header.php) |

          Save the new index.php file.

          Create Redirects

          Use this tool to generate redirects from your old permalink structure to the /%postname%/ permalink structure.

          Your Redirects

          Add the following redirect to the the top of your .htaccess file:

          RedirectMatch 301 ^/https://www.yoursite.com/subfolder/([^/]+)/$ https://www.yoursite.com/https://www.yoursite.com/subfolder/$1

          RedirectMatch 301 ^/https://www.yoursite.com/blog/([^/]+)/$ https://www.yoursite.com/https://www.yoursite.com/blog/$1

          See: https://yoast.com/change-wordpress-permalink-structure/

          Use: https://yoast.com/research/permalink-helper.php/

          See: https://moz.com/blog/subdomains-vs-subfolders-rel-canonical-vs-301-how-to-structure-links-optimally-for-seo-whiteboard-friday

          &

          https://yoast.com/wordpress-seo-url-permalink/

          I hope this helps,

          Tom

          tzfcRzK.png

          1 Reply Last reply Reply Quote 1
          • AngelosS
            AngelosS @MattRoney last edited by

            I am using Wordpress for CMS.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            • Should we 301 redirect old events pages on a website?
              max.favilli
              max.favilli
              0
              3
              334

            • 301 Redirect from now defunct website?
              BCME
              BCME
              0
              5
              352

            • Website, webshop and blog. Subfolders or subdomains?
              Perfect007
              Perfect007
              0
              5
              1.3k

            • 301 redirects within same domain
              FedeEinhorn
              FedeEinhorn
              0
              2
              1.8k

            • DNS or 301 Website Redirect
              Cyrus-Shepard
              Cyrus-Shepard
              0
              5
              3.9k

            • Linking Within Website
              irvingw
              irvingw
              0
              3
              197

            • Splitting one Website into 2 Different New Websites with 301 redirects, help?
              AdamThompson
              AdamThompson
              0
              5
              3.5k

            • How to prevent duplicate content within this complex website?
              StevenvanVessum
              StevenvanVessum
              0
              4
              373

            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