301 a website to mine within a subfolder
-
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?
-
I am using Wordpress for CMS.
-
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.
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/
&
https://yoast.com/wordpress-seo-url-permalink/
I hope this helps,
Tom
- WordPress address (URL):
-
Out of curiosity, what CMS is your site on?
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
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.
Related Questions
-
Is This 301 redirection correct??
Hello Everyone, I have Added This in .htaccess. Options +FollowSymlinks
Intermediate & Advanced SEO | | falguniinnovative
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule (.*) http://www.domain.com/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^./index.html
RewriteRule ^(.)index.html$ http://www.domain.com/$1 [R=301,L] ErrorDocument 404 /index.html Is this Correct ?? or need any change, please help, thanx in advace .0 -
Training Website Improvements...
Hi Folks, I'm in the process of going over our corporate website with a view to improving on-page optimisation, layout, design and user experience and I would like your feedback on what you think I should improve or change with respect to SEO. Some of my ideas include: Restructure Home Page to Better Show Our Services Possibly Add a Slider to the Home Page (I know engagement rates with these are generally low) Restructure the Course Pages Completely (https://purplegriffon.com/courses/itil-training/itil-foundation-training/itil-foundation) Restructure the Events Pages Completely (https://purplegriffon.com/event/2028/itil-foundation) Improve & Streamline the Booking Process AJAXIFY the Booking Process Improve Responsive Elements I'm also interested in conducting user testing before I go ahead and make any changes. What are your thoughts? What would you change? Thanks. Gaz
Intermediate & Advanced SEO | | PurpleGriffon0 -
Does this require site-wide 301 redirects?
I have an old site that we are re-building, and also moving form Yahoo Stores to Big Commerce. yahoo uses site.com/page.html and BC uses site.com/page. Is there any SEO benefit to keeping the old .html format? some of the pages on the old site have no links to them from external sites. Do they even need re-directs, or should I just let Google find the new page equivalents when they crawl the new version of the site? While some of the old pages (primarily product pages) have OK urls, others have obscure product numbers as the URL. Obviously the latter need re-directing to a more relevant page, but what about situations like this:
Intermediate & Advanced SEO | | Grabapple
_/accessory-product.html _ > product-accessory
In this example, the existing URL is fine, except for the .html extention. If I just used the old URL, would having a mix of /sample.html and /sample pages hurt me? Thanks in advance for your help and input! Dave0 -
301 Redirecting Multiple Domains
I have several complete websites with blogs setup for different geo locations and was considering forwarding them all to one domain directly would greatly benefit ranking. The blogs are all linked together and that is where most of the links come from. Would I benefit in 301 Redirecting the domains?
Intermediate & Advanced SEO | | WindshieldGuy-2762210 -
301 redirect
Hi there, I have some good links pointing to one of my web pages at the moment, however we are just about to launch a new design with new URL structure and I am clear that I need to do a 301 redirect on the URL to the new URL. However, do I keep the old URL live forever? or can I remove it after a while? Kind Regards
Intermediate & Advanced SEO | | Paul780 -
After the 301 redirect
Hi all, A quick question, after you have setup your 301 re-directs in .htaccess - is it necessary to keep your content in the original domains directory? My thinking is that requests do get as far as referencing the directory, thus it should be safe to delete all the files on the old domain? Thanx!
Intermediate & Advanced SEO | | gazza7770 -
How to stop Google crawling after 301 redirect?
I have removed all pages from my old website and set 301 redirect to new website. But, I have verified old website with Google webmaster tools' HTML verification file which enable me to track all data and existence of pages in Google search for my old website. I was assumed that, Google will stop crawling and DE-indexed all pages after 301 redirect. Because, I have set 301 redirect before 3 months. Now, I'm able to see Google bot activity on my website with help of Google webmaster tools. You can find out attachment to know more about it. How can it possible & How Google can crawl removed pages? You can see following image to know more about it. First & Second
Intermediate & Advanced SEO | | CommercePundit0 -
301 or What?
Can someone please tell me the 100% correct way to set this up. Would I be right to set up a site this way... type in the browser..."example.com" and it re directs to "www.example.com. or, if i type in "example.com" it goes to example.com. or if I type in "www.example.com" it goes to "example.com"? or, type in "www.example.com" and it goes to "example.com" wouldn't most site link to a "www" version? PS whay isn;t the correct way set up by our HOST.? They should know what is most beneficial? Thanks
Intermediate & Advanced SEO | | SEObleu.com0