Changing the sites root folder
-
Hi am in the process of developing my new site domainname.com/devs/ but my current site is still on www.domainname.com/
When the time comes to launch the new site (in devs folder) I want to change the main root folder to this devs folder.
Is there a correct system to do this with as little pain as possible. I know I will need to go through all of my pages and make sure they are 301 redirected to the new folder, but not sure what the correct way to tackle the domain name root folder change.
Any help would be awesome!
Thanks
-
Also useful: https://github.com/phanan/htaccess. Cheers!
-
Your $1 variable is coming after the '?route=' bit. You can test htaccess code here: http://htaccess.madewithlove.be.
-
Hi Ryan, I have now since moved the website to the old root folder / instead of /devs/. I have also removed the old .htaccess that redirected my domainname.com to domainname.com/devs/.
For some strange reason though I'm still getting the "?route=" whenever i'm doing a new 301 redirect. You can see my htaccess below:
1.To use URL Alias you need to be running apache with mod_rewrite enabled.
2. In your opencart directory rename htaccess.txt to .htaccess.
For any support issues please visit: http://www.opencart.com
Options +FollowSymlinks
Prevent Directoy listing
Options -Indexes
Prevent Direct Access to files
<filesmatch ".(tpl|ini|log)"="">Order deny,allow
Deny from all</filesmatch>SEO URL Settings
RewriteEngine On
If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !..(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]) index.php?route=$1 [L,QSA]Additional Settings that may need to be enabled for some servers
Uncomment the commands by removing the # sign in front of it.
If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
php_flag register_globals off
2. If your cart has magic quotes enabled, This may work to disable it:
php_flag magic_quotes_gpc Off
3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
php_value upload_max_filesize 999M
4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
php_value post_max_size 999M
5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
php_value max_execution_time 200
6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
php_value max_input_time 200
7. disable open_basedir limitations
php_admin_value open_basedir none
redirect 301 /buy-online http://www.foliages.ae/
-
Too bad that didn't work. Your code isn't changing out the URL past "/buy-online" and is appending "?route=" instead.
Plus you're getting duplicate content via:
http://www.foliages.ae/devs/artificial-trees/olive
and
http://www.foliages.ae/artificial-trees/oliveThe help docs on mod_write are here: https://httpd.apache.org/docs/2.2/rewrite/intro.html and they warn, "Rewriting is typically configured in the main server configuration setting (outside any <directory>section) or inside <virtualhost>containers. This is the easiest way to do rewriting and is recommended. It is possible, however, to do rewriting inside <directory>sections or .htaccess files at the expense of some additional complexity. This technique is called per-directory rewrites.
The main difference with per-server rewrites is that the path prefix of the directory containing the .htaccess file is stripped before matching in the RewriteRule. In addition, the RewriteBase should be used to assure the request is properly mapped."</directory></virtualhost></directory>
You'll have to crack this on your own or hire out for it unless someone else chimes in.
-
Hi Ryan, I did this set up but I can't seem to get my 301 redirects to work properly. This is what I have:
www.foliages.ae now points to www.foliages.ae/devs/
But when I try and redirect a page to a new one it doesn't work. For example:
www.foliages.ae/buy-online/artificial-trees-dubai/artificial-olive-trees should point to http://www.foliages.ae/artificial-trees/olive but instead I get http://www.foliages.ae/?route=artificial-trees-dubai/artificial-olive-trees
I have the following .htaccess code in the root folder:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?foliages.ae$
RewriteCond %{REQUEST_URI} !^/devs/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /devs/$1
RewriteCond %{HTTP_HOST} ^(www.)?foliages.ae$
RewriteRule ^(/)?$ devs/index.php [L]And in my /devs/ folder .htaccess I have:
1.To use URL Alias you need to be running apache with mod_rewrite enabled.
2. In your opencart directory rename htaccess.txt to .htaccess.
For any support issues please visit: http://www.opencart.com
Options +FollowSymlinks
Prevent Directoy listing
Options -Indexes
Prevent Direct Access to files
<filesmatch ".(tpl|ini|log)"="">Order deny,allow
Deny from all</filesmatch>SEO URL Settings
RewriteEngine On
If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /devs/
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !..(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]) index.php?route=$1 [L,QSA]Additional Settings that may need to be enabled for some servers
Uncomment the commands by removing the # sign in front of it.
If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
php_flag register_globals off
2. If your cart has magic quotes enabled, This may work to disable it:
php_flag magic_quotes_gpc Off
3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
php_value upload_max_filesize 999M
4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
php_value post_max_size 999M
5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
php_value max_execution_time 200
6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
php_value max_input_time 200
7. disable open_basedir limitations
php_admin_value open_basedir none
redirect 301 /buy-online http://www.foliages.ae
redirect 301 /buy-online/artificial-trees-dubai/artificial-olive-trees http://www.foliages.ae/devs/artificial-trees/oliveAny ideas?
-
Thanks Ryan, I shall give it a go and let you know how I get on.
-
The nice thing about .htaccess is it's easy to test. Save your current file locally, upload a new one with the changes that you think will make your /devs/ folder the new root, and then test. If it doesn't work, overwrite the new .htaccess with the old one and determine where you might have gone wrong. It doesn't involve moving any other files on your server. Again, depending on your host they might have specific instructions for changing the root folder as well.
-
Hi Ryan, I'm running an ecommerce site (opencart) on the /devs/ folder so will that cause me problems do you think if I just copy the files over to the root?
If I follow the link you gave me (bluehostforum) it appears all I need to do is add the code in my .htaccess file. Do I still need to move all the files from my /devs/ folder if I tackle this from the .htaccess file code?
-
There are several ways to do this, but it sounds like you want the files served from /devs/ to appear as root on www.domainname.com.
- Rename current root in FTP to /WHATEVER-old/ and copy the contents of the /devs/ folder into the root.
- Point the domain root to /devs/ instead of it's current root.
- 301 redirect any old page that won't have a matching url on the new site, preferably to the most relevant page content.
- Modify the .htaccess file to point to the /devs/ folder.
Like Ray already said, it is dependent on your hosting setup, CMS or website software, and so on, but setting a root folder is fairly standard. Here's one example from Bluehost.com: http://www.bluehostforum.com/showthread.php?9844-Change-Root-Folder. Your own host should have specific technical documentation.
-
Hi Alex - Are you saying that you want your www.domain.com to resolve to www.domain.com/devs/ ?
If so, I would highly suggest that you consider using www.domain.com as your primary location and URL - unless your website is somehow targeted to 'devs' and it make sense to keep it in the URL structure. If not, it is preferred to have the shorter, more concise URL.
Making this change depends on your host environment and website setup. Are you using a custom web app or something like WordPress?
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
-
HomePage Stopped Ranking For Brand on Aged Site
I've got an odd issue (that I've never encountered in 27 years in SEO). Our home page stopped ranking for our brand "BlowFish SEO" and is no place to be seen when searching our brand. I do get the knowledge panel on the right-hand side of the page. and our about page now comes up number #1. Technically the on-page SEO is correct This page has ranked for many years for our Brand. If I search blowfish SEO west palm beach I get the home page and all the nice site links. And other various variations of branded search. Our company has lots of mentions across the web and branded backlinks. No manual penalty has been placed on us. Im starting to think some type of negative SEO attack but I can't find it. I do know someone is using my name and brand along with many other companies in cloaked doorway redirected pages to gain SEO leads.. Yeah I know I've complained about it to Google they do nothing about it.. Other things I've checked: No one else seems to be using my brand Home page canonical tag points to itself Title tag contains brand name at the front (rest of site it's at the end) No manual penalty XML sitemap contains home page (and accurate for other pages) To make this even more confusing, if you search the brand name the physical location appears on the right rail with an accurate URL. Ive added an image of the search result when I search BlowFish SEO Please note the top result is PPC the about page is 1st organc Any other ideas that I may be missing? BT8F1fD.png
Local Website Optimization | | BlowFish-SEO0 -
Leveraging the authority of a blog to boost pages on a root domain.
Hi! Looking for some link building advice. For some background, I work for a company that has over 100 locations across the US. So we are deeply involved with local SEO. We also do a ton of evergreen/ national SEO as well and the spectrums are widely different for the most part. We also have a very successful blog in our industry. It really is an SEO’s dream. I do not even need to worry about a link strategy for this because it just naturally snatches them up. I’m trying to find some unique ways to utilize the blog to boost pages on my main root domain, more specifically, at the local level. It is really hard, besides the standard methods for local link building, to get outside sources to link to our local office pages. These pages are our bread and butter, and the pages we need to be as successful as possible. In every market we are in, we are at a disadvantage because we have one page to establish our local footprint and rank, compared to domains that have their entire site pointed at that local area we are trying to rank in. I’ve tried linking to local office pages from successful blog posts to attempt to pass link juice to the local pages, but I haven’t seen much in terms of moving the needle doing this. Are there any crafty ideas on how I can shuffle some internal linking around to capitalize on the blog’s authority to make my local pages rank higher in their markets? Thank you! -Ben
Local Website Optimization | | Davey_Tree0 -
SEO for Franchises - Subdomains or Folders?
Wondering if there ever has been any recent consensus on best SEO strategy for a Franchise. I feel it is safe to assume that just having one corporate website with a "store locator" that just brings up the address, phone and hours of a location is not optimal. Yes, the important thing is to get a Google Places for Business listing for each location so you can come up in the 3-pack and regular Maps result, BUT, the rankings for the 3-pack is largely determined by the site's authority and relevance to the specific search term used, IN ADDITION TO, the proximity of the business to the search user's physical location. Apparently it is widely believed that domain authority does not transfer from www.mycorporatedomain.com to somecity.mycorporatedomain.com. And of course we also know there is a potential for a duplicate content penalty, so you can't just duplicate your main site for a number of locations and change the address and phone number on the contact page. If the products and or services are identical for each location, then it's going to be somewhat ridiculous to try and rewrite many sections of the website since the information is no different despite the location. It seems in general more people are advocates of putting location pages or micro-sites in a subfolder of the corporate domain so that it can benefit from the domain's authority. HOWEVER, it is also widely known that the home page (root URL) of any domain carries more weight in the eyes of Google. So let's assume the best strategy is to create a micro-site where phone and address is different anywhere they appear and the contact page is customized to that location, and the "Meet The Staff" page is customized to that location. The site uses the same style 'template' if you will as the main site. Let's also assume you can build a custom home page that has some different content, but still shares the same look and some of the same information as the main site. But let's say between the different phone, address, and maybe some different images and 20% of the content rewritten a bit, Google doesn't view it as dupe content. So would the best strategy then be to have the location home page be: somecity.mycorporatedomain.com and the product and services pages that are identical to the main site you just use a rel canonical to point to the main site? Or, do you make the "home page" for the local business be a subfolder of the main site. So I guess what it boils down to is whether or not the domain authority has more of an effect compared to having a unique home page on a subdomain. What about this? Say the only thing different on the local site is the contact (phone/address) in the header and/or footer of every page, the contact form page, and the meet the staff page. All other content is identical to the corp site, including the home page. I think in that case you need to use a script to serve the pages dynamically. So you would need to server the pages using a PHP script that detects the subfolder name to determine the location and dynamically replaces the phone and address and server different contact and staff pages. You could have a vanity domain mycity.mycorporatedomain.com that does a 301 redirect to the subfolder home page. (This is all ofcourse assuming the subfolder method is the way to go.)
Local Website Optimization | | SeoJaz0 -
What more can be done to get Google to change the landing pages it uses for certain search terms?
For one of my SEO campaigns, Google is using the website's home page as the landing page for the majority of search terms being tracked. The website splits its products by region and so we want specific region pages to rank for search terms related to that region, rather than the home page. We have optimised each regional page to a reasonably high standard and we have ensured that there is a good amount of internal linking and sign-posting to those region pages, however, Google is still using the home page. The only complication is that for the first few months there were canonical tags on these pages to the home page. These were removed around 3 months ago and we've checked that the region pages are indexed properly. Is there anything we are missing? Has anyone had any success in getting Google to change its landing pages?
Local Website Optimization | | ClickHub-Harry0 -
Google can't discern the identity of my site
I have a website, http://NewYorkJazzEvents.com, that promotes jazz bands that are available for brides looking to hire a jazz band to perform at their wedding, or event planners looking to hire a jazz band to perform for a corporate event, etc. This identity, that my site is an Entertainment Agency, is made clear by all of the content on my site, as well as all of the content on its associated sites (such as its linked Facebook, YouTube, and Google Business pages, and many local citations). Yet, contrary to all of this data, the mere presence of the word "events" in my URL and business name has led Google to believe that my site is a Live Jazz Guide, i.e., a site that lists public performances of jazz groups in New York City. The problem, then, is that Google displays the site when people search for local events listings, and not when they search for jazz bands to contract for private events. For example, do a search for "jazz bands new york" and up pops the listings for sites catering to searchers looking to hire bands for private events, like Gigmasters, Gigsalad, right at the top of the list, followed by lots of individual bands. My site is buried (in my results, anyway), on the middle of page 2. (My paid Adwords ad, on the other hand, shows up at the top of paid ads.): https://www.dropbox.com/s/sv4we4gvnb6wkyb/Screenshot%202016-04-11%2019.22.40.png?dl=0 Now do a search for "new york jazz events." Boom! I'm #1 in the natural results, and, unlike in the search for "new york jazz band," my Google plus page and map (or is it the "knowledge graph"?) display right at the top of the right column: https://www.dropbox.com/s/nob24x1b8u1g4or/Screenshot%202016-04-11%2019.18.49.png?dl=0. (Pretty useless to people searching for live jazz listings in New York, though.) (This, by the way, is an additional related frustration: why does Google display all of its local information (its map, links to my Google reviews, etc.) next to my site listing when people are searching for events, but but hides this valuable information next to my site listing when people are search for jazz bands (when my site comes up on page 2)?) For a further confirmation of Google's confusion, see this data from Google that indicates the top search queries that it is using to display my site are centered around searches for local live jazz listings: Google Search Console > Search Traffic > Search Analytics > Queries: https://www.dropbox.com/s/t8blxv6a077iuw6/Screenshot%202016-03-07%2012.28.38.png?dl=0 See also see this data from Google that indicates that it see "events" (which it understands as local live jazz listings) rather than "new york jazz bands" as the essential keyword describing the identity of the site: Google Search Console > Google Index > Content Keywords: https://www.dropbox.com/s/6nk6skfgx9zjzgc/Screenshot%202016-03-07%2012.46.04.png?dl=0 It's been this way for several years. I thought Google was supposed to be smart, but it's pretty dumb in this case (all the other search engines, including Bing, are quite a bit more intelligent). All this trouble, essentially from a word within a URL? Does anyone have an idea of the cause of this issue, and any potential cures? What can I do to clear up Google's confusion?
Local Website Optimization | | ChuckBraman0 -
SEO for local business directory type site
I am thinking about creating a local business directory type website that lists all local Tattoo Shops. I am familiar with both local and global SEO and how to differentiate between them, however, I am not sure how I should approach this type of website. It isn't an actual business, but I want to target local searches that are looking for tattoo shops. In other words, when someone types in "tattoo shops" or "tattoo shops near me", or "tattoo parlors", I want the website to appear. Is this something that is manageable, or will the individual Tattoo Shop websites always show before mine since they are real local businesses with google+ pages?
Local Website Optimization | | brfieger0 -
Bing ranking a weak local branch office site of our 200-unit franchise higher than the brand page - throughout the USA!?
We have a brand with a major website at ourbrand.com. I'm using stand-ins for the actual brandname. The brand is a unique term, has 200 local offices with sites at ourbrand.com/locations/locationname, and is structured with best practices, and has a well built sitemap.xml. The link profile is diverse and solid. There are very few crawl errors and no warnings in Google Webmaster central. Each location has schema.org markup that has been checked with markup validation tools. No matter what tool you use, and how you look at it t's obvious this is the brand site. DA 51/100, PA 59/100. A rouge franchisee has broken their agreement and made their own site in a city on a different domain name, ourbrandseattle.com. The site is clearly optimized for that city, and has a weak inbound link profile. DA 18/100, PA 21/100. The link profile has low diversity and generally weak. They have no social media activity. They have not linked to ourbrand.com <- my leading theory. **The problem is that this rogue site is OUT RANKING the brand site all over the USA on Bing. **Even where it makes no sense at all. We are using whitespark.ca to check our ranking remotely in other cities and try to remove the effects of local personalization. What should we do? What have I missed?
Local Website Optimization | | scottclark0 -
Sites Verification Issues
We have a group of automotive dealerships by a website provider that causes issues when trying to verify our sites. Because they use Analytics for their data program, they install a code into our websites-stopping us from doing so properly in our back end. We also cannot verify ourselves in webmasters or adwords. We can't actually "own" any of our sites since they run a java query script from within the website. They also do not allow the use of iframes or scripts, so we can't even use the container to verify these sites. Any help or insight would be greatly appreciated as I am sure there is some way to break this to get our data and be verified.
Local Website Optimization | | spentland0