I had read here a post by "butte" expressing a clear preference for OC installation in a subfolder rather than in the root. I want to understand implications of pointing my domain (through CPanel setting)to the subfolder with OC installation:
1. For search engine (Google et al) indexing
2. Internal links: the subfolder should not be visible
3. Anything to be done to OC config files ?
4. Anything to be done to .htaccess files - in the root & in the subfolder?
I am asking this basic question, because there is no comprehensive answer to all these questions in the forum. Thanks.
1. For search engine (Google et al) indexing
2. Internal links: the subfolder should not be visible
3. Anything to be done to OC config files ?
4. Anything to be done to .htaccess files - in the root & in the subfolder?
I am asking this basic question, because there is no comprehensive answer to all these questions in the forum. Thanks.
Engines and the server itself deal with "pages" relative to a base directory (basedir) where a domain is supposed to land traffic, be that the account root or a specified directory on the account root or above that. The paths themselves are unavoidable, what matters is where the basedir is, relative to the server's own address, the account's own address, and the domain or subdomain or any directories positions. Paths do not determine searchability or rank. The config.php and .htaccess are always amended as necessary to reflect whatever the paths are, for the sake of pointing to and relative to a relevant basedir.
Thanks, butte. Let me rephrase my question:
I have developed a new version of the store (with OC upgrade & different theme) in a subfolder 'test' in the root of 'mydomain.com'. I do not want to move contents of the subfolder 'test' to root. But I want 'mydomain.com' to load the new store in the subfolder. What is the best way of doing this?
Thanks again for your clarification.
I have developed a new version of the store (with OC upgrade & different theme) in a subfolder 'test' in the root of 'mydomain.com'. I do not want to move contents of the subfolder 'test' to root. But I want 'mydomain.com' to load the new store in the subfolder. What is the best way of doing this?
Thanks again for your clarification.
You point each subdomain (www. is "the first" subdomain, you name the rest) to its own directory (at or above root). You can do that from registrar using dns A (or unpreferred dns cname) or using forwarding, and you can do that inside webhost account by redirection and .htaccess. Cleanest is straight from registrar, dns A or path-forwarded (can't do both at same time). Registrar and webhost may be same company, are often separate, keeps eggs out of one basket when whole server system goes down or host goes belly up (happens).
In my case registrar & hosting service are different. If I do the redirect for domain "xyz.com" to "public_html/text/", using hosting service provider's cpanel, will the internal urls appear as "xyz.com/somepage" or still as "xyz.com/test/somepage"? Thanks.
[If I do the redirect for domain "xyz.com" to "public_html/text/", using hosting service provider's cpanel, will the internal urls appear as "xyz.com/somepage" or still as "xyz.com/test/somepage"?]
The directory structure that is ASSIGNED TO the (sub)domain does not show, such as public_html/ikkyburg/ won't show if it in effect IS beautybeast.com, but additional subdirectories will show, such as only whee/ will show when beautybeast.com/whee/pagename is addressed (directories before the whee/pagename won't show).
IF on your host public_html/text/ is ASSIGNED TO xyz.com, then xyz.com will show as xyz.com/pagename (or as xyz.com/) when it lands. If you address an additional sub directory, that will "pass" and show, such as xyz.com/landhere/ (INSIDE text/ which is assigned to xyz.com already). If you specify a page, that will show as xyz.com/pagename (or in the preceding case as xyz.com/landhere/pagename). The trailing slash cues the browser that the index will be called by type (index, be it .html, .htm, .php, or other), not a specific file by name (pagename, be it .html, etc.).
[Name changes]
A domain has a registrar for its name and a host for its website. The registrar has three essential ways to send its traffic to its host. One is dns A, to its host's 1.2.3.4 machine address. Next if available is forwarding to another doman/directory (NOT to a 1.2.3.4 machine address), either stealth IN ITS OWN NAME or non-stealth IN THE TARGET'S OWN NAME. In each case the host is set up to host the domain(s), and the host nameservers know where in the machine to send each domain's traffic, such as both .com and .net to different directories, to the same directory but both as .net, or to the same directory but both as .com instead.
Redirection can be done with the registrar or the host, either stealth or non-stealth, and either permanently or temporarily, such as to a target name/directory address already associated with a domain. A .net or .com can arrive in its own name, or can appear with a different name.
The directory structure that is ASSIGNED TO the (sub)domain does not show, such as public_html/ikkyburg/ won't show if it in effect IS beautybeast.com, but additional subdirectories will show, such as only whee/ will show when beautybeast.com/whee/pagename is addressed (directories before the whee/pagename won't show).
IF on your host public_html/text/ is ASSIGNED TO xyz.com, then xyz.com will show as xyz.com/pagename (or as xyz.com/) when it lands. If you address an additional sub directory, that will "pass" and show, such as xyz.com/landhere/ (INSIDE text/ which is assigned to xyz.com already). If you specify a page, that will show as xyz.com/pagename (or in the preceding case as xyz.com/landhere/pagename). The trailing slash cues the browser that the index will be called by type (index, be it .html, .htm, .php, or other), not a specific file by name (pagename, be it .html, etc.).
[Name changes]
A domain has a registrar for its name and a host for its website. The registrar has three essential ways to send its traffic to its host. One is dns A, to its host's 1.2.3.4 machine address. Next if available is forwarding to another doman/directory (NOT to a 1.2.3.4 machine address), either stealth IN ITS OWN NAME or non-stealth IN THE TARGET'S OWN NAME. In each case the host is set up to host the domain(s), and the host nameservers know where in the machine to send each domain's traffic, such as both .com and .net to different directories, to the same directory but both as .net, or to the same directory but both as .com instead.
Redirection can be done with the registrar or the host, either stealth or non-stealth, and either permanently or temporarily, such as to a target name/directory address already associated with a domain. A .net or .com can arrive in its own name, or can appear with a different name.
Hi butte
Sorry I am bothering you again. So you prefer
1.Installation of the development store in a sufolder (say "test") in "public_html"
2. Creating a sub-domain (say "test.mysite.com") & mapping it to this subfolder
3. Redirecting domain (mysite.com) to the subdomain.
Right (A)?
I am going to have SEO urls.
In that case htaccess in sub-folder will just have:
And lastly, "config.php" & "admin/config.php" (in sub-folder) will refer to "test.mysite.com" instead of "mysite.com/test" for the HTTP_ & HTTPS_ definitions,
but give full directory path (/server/user/public_html/test/file_directory/) for DIR_ definitions.
Right (C)?
Thanks for your patient & enlightening replies and regards.
Sorry I am bothering you again. So you prefer
1.Installation of the development store in a sufolder (say "test") in "public_html"
2. Creating a sub-domain (say "test.mysite.com") & mapping it to this subfolder
3. Redirecting domain (mysite.com) to the subdomain.
Right (A)?
I am going to have SEO urls.
In that case htaccess in sub-folder will just have:
Right (B)?RewriteEngine On
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]
And lastly, "config.php" & "admin/config.php" (in sub-folder) will refer to "test.mysite.com" instead of "mysite.com/test" for the HTTP_ & HTTPS_ definitions,
but give full directory path (/server/user/public_html/test/file_directory/) for DIR_ definitions.
Right (C)?
Thanks for your patient & enlightening replies and regards.
(A) It's certainly not a bother. Yes, (1), (2). Depends, (3) -- if you want the store to be the primary feature of the website, then yes; the subdomain(s) allow specifically targeting that or other features (you might have a blog, a forum, a whatnot, that you would want to be able to address specifically, analogously to how mail can go to household or to someone named).
(B) Rewritebase requires store's own root, which would be not / (meaning public_html as root) but /test/ (with trailing /).
(C) The http addresses (B) are what will be in address bars, http: // subdomain.domain.com/ (already pointed to /test/).
Bring back any wrinkles. You'll be dealing with your "zone" records and dns A will often have two settings for each alternative, a non-www and a *, a www and its *, a namedsubdomain and its *, etc.. Look at your dns A as you go, if you see any * then your settings panel is allowing and expecting the * entries -- in some settings panels you won't see them, and they may well just appear automatically along with whatever you just entered and saved. The * takes care of the situations we see where even subdomain is prefixed., as in wwx.subname.domain.com or the like. If for any reason you expect to do prefixed. addresses, you'll probably need * for subdomain. If a * entry just shows up along with whatever domain or subdomain you had entered the normal way, then leave it be. You can ask support how they want * handled, if it is not obvious or bugs you.
(B) Rewritebase requires store's own root, which would be not / (meaning public_html as root) but /test/ (with trailing /).
(C) The http addresses (B) are what will be in address bars, http: // subdomain.domain.com/ (already pointed to /test/).
Bring back any wrinkles. You'll be dealing with your "zone" records and dns A will often have two settings for each alternative, a non-www and a *, a www and its *, a namedsubdomain and its *, etc.. Look at your dns A as you go, if you see any * then your settings panel is allowing and expecting the * entries -- in some settings panels you won't see them, and they may well just appear automatically along with whatever you just entered and saved. The * takes care of the situations we see where even subdomain is prefixed., as in wwx.subname.domain.com or the like. If for any reason you expect to do prefixed. addresses, you'll probably need * for subdomain. If a * entry just shows up along with whatever domain or subdomain you had entered the normal way, then leave it be. You can ask support how they want * handled, if it is not obvious or bugs you.
Thanks very much, butte.
I was wondering re: htaccess (Section 'B' above) whether it is necessary to specify Rewitebase as "/test/", since we have declared in config file's http/https sections "test.mysite.com" (not "mysite.com")
I was wondering re: htaccess (Section 'B' above) whether it is necessary to specify Rewitebase as "/test/", since we have declared in config file's http/https sections "test.mysite.com" (not "mysite.com")
I came acroos an article titled "How to host the Primary Domain from a sub-folder" using ".htaccess" here:
https://my.bluehost.com/cgi/help/347
It essentially advocates using a ".htaccess" in the root:
Would this apply to Opencart also? In that case would the config files (of course in the sub-folder) refer to primary domain or sub-domain as HHTP & HTTPS definitions?
https://my.bluehost.com/cgi/help/347
It essentially advocates using a ".htaccess" in the root:
Code: Select all
# BlueHost.com
# .htaccess main domain to subdirectory redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subdirectory/
# Don't change these line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subdirectory/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ subdirectory/index.html [L]
(1) Yes, and both.
(2) You have an account, which sits in a particular part of the server's entire drive (shared with other accounts). That account has a public root, located inside your own www/ or public_html/ or htdocs/ or similar. Your account has a nnn.nnn.nnn.nnn machine address. You have (or host) at least one domain, you must host one domain in order to host a subdomain of it, and you must list that as hosted in your account in your control panel for that account. When traffic for a (sub)domain (either one) reaches your account, the root is read for .ht files and then index files, for where to send the (sub)domain, namely to the root or directory where it resides.
In your control panel you will have preset your hosted domains. When you did that you may have told the server where your domain lives. If you are allowed several domains, then your server likely have put all of them into their own directories-- out of (above) the public root itself.
Arriving traffic in the public root will first be fed .htaccess if it is there, then an index.html, index.htm, or index.php file if .htaccess does not say to go somewhere else (above the public root). A single domain in the root does not require .htaccess, and .htaccess does not have to send traffic elsewhere.
(3) In your DOMAIN REGISTRATRAR ACCOUNT you start traffic direction, there is at least a pair of nameservers and associated with them there are settable DNS A records which point to nnn.nnn.nnn.nnn macine addresses. Those may be with the registrar or with the two-hatted registrar-webhost. The "first subdomain" is www. -- which must go wherever the domain goes. Other subdomains can be sent there or anywhere else on the planet.
In your DOMAIN WEBHOST ACCOUNT all of the traffic you sent, to your account machine's nnn.nnn.nnn.nnn address, from any number of registrars anywhere, through DNS A records for all manner of domains and subdomains, arrives and is fed .htaccess and a sequence of index files.
(4) What you have from that particular host appears to be from a single-domain hosting account. When you can host more than one, directives are set up for each and every domain whose main self or subdomains are hosted in your account. Then traffic to EACH of them is sent to where it resides. That file above is not a plain model to follow for plural domains but the essential guts are there.
(2) You have an account, which sits in a particular part of the server's entire drive (shared with other accounts). That account has a public root, located inside your own www/ or public_html/ or htdocs/ or similar. Your account has a nnn.nnn.nnn.nnn machine address. You have (or host) at least one domain, you must host one domain in order to host a subdomain of it, and you must list that as hosted in your account in your control panel for that account. When traffic for a (sub)domain (either one) reaches your account, the root is read for .ht files and then index files, for where to send the (sub)domain, namely to the root or directory where it resides.
In your control panel you will have preset your hosted domains. When you did that you may have told the server where your domain lives. If you are allowed several domains, then your server likely have put all of them into their own directories-- out of (above) the public root itself.
Arriving traffic in the public root will first be fed .htaccess if it is there, then an index.html, index.htm, or index.php file if .htaccess does not say to go somewhere else (above the public root). A single domain in the root does not require .htaccess, and .htaccess does not have to send traffic elsewhere.
(3) In your DOMAIN REGISTRATRAR ACCOUNT you start traffic direction, there is at least a pair of nameservers and associated with them there are settable DNS A records which point to nnn.nnn.nnn.nnn macine addresses. Those may be with the registrar or with the two-hatted registrar-webhost. The "first subdomain" is www. -- which must go wherever the domain goes. Other subdomains can be sent there or anywhere else on the planet.
In your DOMAIN WEBHOST ACCOUNT all of the traffic you sent, to your account machine's nnn.nnn.nnn.nnn address, from any number of registrars anywhere, through DNS A records for all manner of domains and subdomains, arrives and is fed .htaccess and a sequence of index files.
(4) What you have from that particular host appears to be from a single-domain hosting account. When you can host more than one, directives are set up for each and every domain whose main self or subdomains are hosted in your account. Then traffic to EACH of them is sent to where it resides. That file above is not a plain model to follow for plural domains but the essential guts are there.
Who is online
Users browsing this forum: Bing [Bot] and 61 guests