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
-
Home page showing some other website in cache
My website (www.kamagrauk.com) is showing www.likeyoursaytoday.com in google cache website domain further redirect to http://kamagrauknow.com/ problem :1) info:kamagrauk.com shows www.likeyoursaytoday.com2) cache:kamagrauk.com shows www.likeyoursaytoday.comwww.likeyoursaytoday.com copied content from kamagraoraljelly.mei already checked done1) changed website hosting (New Virtual private server)2) Uploaded Fresh backup of website 3) Checked header response ( DNS perfect)4) Checked language meta tag (no error)5) fetch function worked fine 6) try to remove url and readded 7) no error in sitemap8) SSL all Ok9) no crawl errorsnothing worked ....... trying to contact www.likeyoursaytoday.com but not responding backToday (23rd feb) www.likeyoursaytoday.com gone down but our cache been replaced http://www.bagnak.com/so it seems google not able to read our page but here i am attaching screen shoot which google sees everything okblocked%20resources.png cache.png crawlerror.png robots%20test.png
Intermediate & Advanced SEO | | Gauravbb1 -
301 or Canonical - Ecommerce Site Question
We are making a change to our Navigation and this includes having to change the URL structure of a few pages of our site. Due to issues with the CMS (that are out of my control) we are unable to keep the current URL structure of two of our highest ranking pages. Our site is an E-commerce Site The Structure is changing from..... www.domain.com/page/highrankingpage <----OLD PAGE RANKED WELL to www.domain.com/category/highrankingpage <----NEW PAGE Generally I would have 301 'd this page but I found out that our Tech team added a Canonical to this page instead....(showing the high ranking page to the Search Engines) and on our site the visitors are able to browse the website getting the new page. BOTH PAGES ARE BASICALLY IDENTICAL (Same Content) http://searchenginewatch.com/sew/how-to/2288690/how-and-when-to-use-301-redirects-vs-canonical# Thoughts?
Intermediate & Advanced SEO | | CMcMullen0 -
Subdomain or subfolder for each country
Hi all I have a great .com domain but the cctlds are not available so I plan on using the .com for all the countries and languages. What is the best approach for SEO: subdomains like wikipedia does (de.greatdomain.com) or subfolders (greatdomain.com/de)? I know this question comes up frequently on other websites but I would like to hear the Moz forum.
Intermediate & Advanced SEO | | AndersDK0 -
Stolen website content
Hello, recently we had a lot of content written for our new website. Unfortunately me and my partner have went separate ways, and he has used all my unique content on his own website. All our product descriptions, about us etc, he simply changed the name of the company. He has agreed to take the content down, so that i can now put this content on our new website which is currently being designed. Will google see this as duplicate content as it has been on a website before? Even though the content has been removed from the original website. I was worried as the content is no longer "fresh" so to speak. Can any one help me with this,
Intermediate & Advanced SEO | | Alexogilvie0 -
Too many 301 redirects?
Hey, My company currently has one chief website with about 500-600 other domains that all feature the same material as the chief website. These domains have been around for about 5 years and have actually picked up some link traffic. I have all of these identical web-pages utilizing rel=canonical but I was wondering if I would be better served, from SEO purposes, to 301 redirect all of these sites to their respective pages on our chief website? If I add 500 301 redirects, will the major search engines consider this to be black-hat link-building even though the sites are related and technically already feature the same content? For an example, the chief website is www.1099pro.com and I would 301 redirect the below sites to the chief site: 1099softwarepro.com 1099softwarepro.info 1099softwarepro.net 1099softwarepro.biz 1099softwareprofessionals.com 1099softwareprofessionals.info ...you get the point
Intermediate & Advanced SEO | | Stew2220 -
Blogs and E-Commerce websites
I have recently launched an e-commerce website which has a whopping domain authority of 1! I was thinking about adding a blog to it (it's in open cart), but that would mean creating it in a wordpress but using the same domain name. Would this be beneficial from an SEO stand point (i.e sending traffic to w blog that isn't actually on the e-commerce website itself) , or am I better off creating content as blogs/articles on other people sites?
Intermediate & Advanced SEO | | lindsayjhopkins0 -
301 redirect
I have 2 websites, lets call them Website A and Website B. Website A is a commercial website, website B is a 7 years old blog. Website B has many natural, high quality BL, including some from Nytimes, etc. I want to integrate the blog (B) into the commercial website (A). The idea behind this thought is to compress the two websites, it is easier to have everything in one place. I will do this with 301 redirect via Webmaster tools, htaccess etc. The uRL structure will remain the same: eg: websiteB/post-title/ -> websiteA/post title What will happen with my quality BLs? Is there any chance to be penalized by Google? What will happen with the PR of the 2 sites? Thanks.
Intermediate & Advanced SEO | | jasmin281 -
301 redirect for ip address in SERPs
Hi, I've recently had the misfortune of my site's ip address being crawled and indexed by Google, which is causing some duplicate content issues. Due to the nature of the site we're not able to implement a canonical tag to fix this at present. Would a 301 redirect do the trick, and if so, could someone point me to what I'd need to add to our .htaccess file? Many thanks Chris
Intermediate & Advanced SEO | | ChrisHillfd0