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
-
Company sells home appliances and commercial appliances. What is the best way to differentiate the two on our site for the best user experience/SEO?
Should we structure it starting at the homepage with the user selecting for home or for business, that way they have to make a selection before moving further OR should we somehow differentiate in the navigation using the top menu tabs, dropdowns, etc?
Local Website Optimization | | dkeipper1 -
Does it matter how or what site you use to GeoTag your photos?
I found a site that was very easy for me to upload my pictures, add the coordinates, download it and put it on my site. The site is GeoImgr.com, but it's not nearly as popular as some of the other's out there. Does that matter? I'm under the impression that as long as the GPS coordinates show up in the XIF Viewer, then I've gotten whatever benefit (albeit slight) there is to get. Is that correct? Or is there something about tagging them from the more popular sites like Flickr or Panaramio? Thanks, Ruben
Local Website Optimization | | KempRugeLawGroup0 -
How to approach SEO for a national umbrella site that has multiple chapters in different locations that are different URLS
We are currently working with a client who has one national site - let's call it CompanyName.net, and multiple, independent chapter sites listed under different URLs that are structured, for example, as CompanyNamechicago.org, and sometimes specific to neighborhoods, as in CompanyNamechicago.org/lakeview.org. The national site is .net, while all others are .orgs. These are not subdomains or subfolders, as far as we can tell. You can use a search function on the .net site to find a location near you and click to that specific local site. They are looking for help optimizing and increasing traffic to certain landing pages on the .net site...but similar landing pages also exist on a local level, which appear to be competing with the national site. (Example: there is a landing page on the national .net umbrella site for a "dog safety" campaign they are doing, but also that campaign has led to a landing page created independently on the local CompanyNameChicago.org website, which seems to get higher ranking due to a user looking for this info while located in Chicago. We are wondering if our hands are tied here since they appear to be competing for traffic with all their localized sites, or if there are best practices to handle a situation like this. Thanks!
Local Website Optimization | | timfrick0 -
SEO and Redirecting Site to a Different Firm's Domain while Maintaining Current Domain's Rankings
I am a plaintiffs' attorney with a website that ranks well for my major practice areas. I am considering taking a position with a new firm. As part of the discussion, the new firm would allow me to keep my current site so long as it redirects to my bio page on their firm's site. My goal is to keep my current site ranking well and continuously work on SEO efforts, in case I leave the new firm and want to rely on my current site in the future. My questions are: Is there a way to redirect my site every time it shows up in the listings (I have 1000+ indexed pages) without sacrificing its current rankings b/c of bounce rate issues, etc and 2) If I continue to add pages and work on SEO for my site while it redirects to another, will those efforts be worthwhile due to the redirect? I want to keep trying to build my site even though it redirects to a page on a different domain.
Local Website Optimization | | crpoll0 -
Combining sites. But what domain to use?
So we currently have two websites: www.thephotoboothguys.co.uk and www.thephotoboothguys.com.au We're redeveloping our sites, and combining them to have just a singular website (and then sub sections for each country / location). Unfortunately we can not get the .com of our domain, nor the _.net _And I really can't find a .com that i think will work (for lack of availability, or just because the domain name would not be succinct enough). So, I also have registered - www.photobooth.gy and www.thephotoboothguys.co
Local Website Optimization | | blitzna10
My question ultimately is - is it a bad idea to use a .gy or .co as my main domain - especially when we dont operate in either Guyana or Columbia - but, assuming that the content and structure of the website make it clear what countries and locations we do operate in. Is this something Google et al will figure out over time? Or is it likely to make a huge impact? Or should I be searching harder to find a .com that will work for me? Cheers!0 -
Best marketing for a language learning site
Hello everybody, I'm a programmer so I'm not very good at marketing. Any idea what the best way is to promote my language learning site? (http://www.antosch-and-lin.com/) Since Google Penguin the site has taken a big hit and the changes suggested by a SEO expert hasn't helped. Thanks for any suggestions!
Local Website Optimization | | delpino0 -
Perfect Site Structure help please and EMD question
Hello to all, I appreciate your time and trouble greatly, so thank you in advance. Question - 1 - I just watched a video regarding onsite <acronym title="Search Engine Optimization">seo</acronym>. This video explained to instead of using a services page to list each service, instead if possible make a page and menu item for the most popular search terms. So my families business site is allspecialtybuildings.com We do construction. I currently have it setup to have a services page then the listings of the services with its own page under the menu. But from watching this video, would you also suggest that it would be best to take maybe the top 3 or 4 services, then list the services as actual page menus? So say instead of this: Service Menu Link -
Local Website Optimization | | Berner
-Pole Barns
-Indoor Riding Arenas
-Garages
-Horse Barns
-Loafing Sheds Would it be best to have each service as a menu in itself like this: Home
Pole Barns
-Pole Barn Construction
-Pole Barn Kits
-Pole Barn Color Charts Indoor Riding Arenas
-Indoor Riding Arena Construction
-Indoor Riding Arena Kits
-Indoor Riding Arena Color Charts Same- Different word
Same- Different Word So basically create specific and relevant pages and remove the popular pages from a service page. Not sure if this make sense, or is basically not needed? Last Question - Branding- I got 2 <acronym title="Search Engine Optimization">seo</acronym> companies reviews back, and was told to change my branding and domain. See the issue is that the company name is All Specialty Buildings. So All is basically thrown out of some search results, almost like its a stop word. So "Specialty Buildings" shows up on many results. I would like to counter this. So I am curious if I get a new domain, like say something like ColoradoBarnConstruction.com Would this be a better domain for <acronym title="Search Engine Optimization">seo</acronym> rankings and memory for people? Or would I risk an EMD penalty? When I look for dentists, or <acronym title="Search Engine Optimization">seo</acronym> help, I get coloradodentist, or coloradoseo(dot)com's So they all rank well, I just want something brandable and easy to remember. I figured the company name would be best, But these companies that want 3500 a month for <acronym title="Search Engine Optimization">seo</acronym> services are saying different. Again thank you for your time, your ideas, and your advice. Thank you Chris0 -
Site was hacked - do I need to change my phone number?
The site I was leasing was hacked about a year ago. I've bought a new domain and changed everything about the site. It is completely separated from the old domain. However, my current phone number is still visible on the old site and I can't get it down. I really don't want to get a new phone number, but the SEO success of my new site is extremely important. Is there anyway the fact that my old phone number on the hacked site could hurt my new site's standing in Google? Thank you so much!
Local Website Optimization | | OptimizationMegan0