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
-
How to increase DA of website?
My website Domain Authority is not improving what should I do to improve DA of website
Intermediate & Advanced SEO | | JOkoiue0 -
How do I increase my website DA and PA?
I want to launch a new site like www.plaza.ir. How can I improve its Da and PA quickly ?
Intermediate & Advanced SEO | | arpaymantul0 -
(Urgent) losing traffic after 301 redirect
We face a seo problem of losing traffic after 301 redirect.We have used 301 redirect from a sub-domain url to main domain, after a few month, we discovered that the traffic in google is dropped 40% as well as yahoo dropped 50% without reason, we have updated sitemap already, but we cannot find any reason for the traffic dropped till now..The original url (more then 5000 links)https://app.example.com/ebook Redirected Urlhttps://www.example.com/ebookThank you for your help!
Intermediate & Advanced SEO | | yukung0 -
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 -
Website change of address
Hi Everyone, I apologize if the answer to this questions is obvious, but I wanted some input on how changing our web address of our site will affect our SERP. We are looking to change our website address from a.com to b.com due to rebranding of our company (primarly to expand our product line as our current url and company name are restricting). I understand that this can be done using 301 direct and via webmaster tools with google. My question is how does this work exactly? Will our old website address show in SERP rankings, and when a user clicks on the listing are they redirected to our new address? With regards to building new links from press releases etc, do we have links point to our new web address or the old one in order to increase SERP? Does google see our old address and new address as the same website and therefor it does not matter where inbound links point to and both will increase our ranking positions? It took 6 years of in house seo to get our website to rank on the first page of all the major search engines for our keywords, so we am being very cautious before we do anything. Thanks everyone for your input, it is greatly appreciated 🙂
Intermediate & Advanced SEO | | AgentMonkey0 -
Redirects 301
Hello guys, I have a doubt. If I reedirect a url with a pagerank of 2 to a new URL, will I loose the PR? My problem is that I have a long url in one page wich is not effective to target a keyword that Im persuing. Im climbing in Google, however I want to 1º place and I dont think that with this long URL I will make it. Advices? Cheers! Pedro M Pereira
Intermediate & Advanced SEO | | PedroM0 -
How to gain more conversions through my website
Hello, I have a wealth coaching website bobweikel(dot)com Will you look at it and tell me how I can improve traffic and conversions. I want to gain several clients a week just from the web. Possible areas of help: On-site SEO & keywords link building: I don't see how to link build here Content Creation Adwords Thanks!
Intermediate & Advanced SEO | | BobGW0 -
Optimising My Website Link Containers
Hi, I'm looking at my links containers and trying to optimise them. I would be greatful if anyone can give me some feedback on my plan for perfect optimaisation. My links are constructed as follows: I have a two states:
Intermediate & Advanced SEO | | James77
1/. A Non Hover state which contains an Image and Text
2/. A Hover state which contains a bit more text - I do this as containing full text on the non hover state would not be good for users and would look ugly as well. Here's an example block of the HTML - as you can see from the URL, its quite a deep page level. From the URL and Alt / Titles the Page I am Linking to is about: "The Royal Hotel Accommodation New York Holidays". I Just a bit confused on how I should apply ALT and Title (Titles in particular) attributes given the nested DiV's etc - I can apply these to parent level, or apply all levels, or apply them to a mix. Also is there any obvious thinks you can think of I am missing that may help onsite SEO? Thanks in Advance CURRENT UNOPTIMISED CODE:
The Royal Hotel
New York Holidays Accommodation
The Royal Hotel
MY OPTIMISED CODE (Adding Title and Alt attributes):
The Royal Hotel
New York Holidays Accommodation
The Royal Hotel
0