Post by jrjr » Sun Mar 02, 2014 11:09 pm

With my Joomla installs I leave my domain empty and point to a subdomain. Things work the way they should.... for example if my domain is domain.com and my subdomain is domain2.domain.com, when viewing the address bar it always shows domain.com/pages on all subsequent pages of the site.... which is what I want.

Then if there is an issue with the install that I am using, I can simply point to a mirror install, lets say domain3.domain.com while I fix the first one and the address bar still shows domain.com/pages as it should and as I wish it to be.

With opencart though if I try this, the front page will show domain.com but all subsequent pages will show up as domain2.domain.com/page

Can this be corrected in the address configurations that are in the config files?

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by butte » Mon Mar 03, 2014 4:24 am

OC has its own .htaccess, either redirect there to the subdomain you intend (in its own directory on the server), or instead change DNS A for it (but that takes propagation time to make it go and a second time to undo it).

OC inside joomla is jailed and is riddled with joomla code unless you set it up as completely independent in the first place rather than using ace or mijo.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by jrjr » Mon Mar 03, 2014 5:18 am

butte wrote:OC has its own .htaccess, either redirect there to the subdomain you intend (in its own directory on the server), or instead change DNS A for it (but that takes propagation time to make it go and a second time to undo it).

OC inside joomla is jailed and is riddled with joomla code unless you set it up as completely independent in the first place rather than using ace or mijo.
I was not talking about OC inside Joomla..... just straight Joomla sites.

If I redirect with .htaccess won't it still show the URL of the subdomain?

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by butte » Mon Mar 03, 2014 5:25 am

You can use 301 or 302 to fit need; at either level. You can redirect in the root .htaccess file. If there is no .htaccess where one OC sits, you can add it and redirect there. Each subdomain, alike each domain, can be (re)directed, and can be made to appear with or without its very own name in the address bar.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by jrjr » Mon Mar 03, 2014 5:38 am

Ok so I tried both:

Redirect 301 / http://domain2.domain.com/
Redirect 302 / http://domain2.domain.com/

Both instances redirect to the subdomain but the URL is showing the subdomain
http://domain2.domain.com/

I can do that with the pointer from my host

This is not what I want.... I want it to show http://domain.com/ but using the subdomain files

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by butte » Mon Mar 03, 2014 5:55 am

If they are on the same machine, then try in your control panel setting up a redirection from one directory to the other. It will probably generate a .ht* file, there are several kinds, that should cure the problem. How severs work that varies, so you may need to ask host support.

There may be on the registrar account (or the registrar side of the host) a device called forwarding, which can be stealth (keeps own name, e.g., as in sending .com or .net to each other with no visible change) or non-stealth (takes on name of target upon landing, e.g., both show as .com or both show as .net). That has become less prevalently available.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by jrjr » Mon Mar 03, 2014 6:08 am

What is an .ht* file?
Google doesn't return anything useful about that.

I have already said that my host has the redirect available ...... they call them pointers and I have used them. They work with Joomla sites and the domain url shows up no matter what sub domain I point at and use. Not open cart inside Joomla, straight Joomla sites.

They also have masking which puts the sub in a full page I Frame but the url never changes with that strategy.

Open Cart does not behave like Joomla as it shows the url of the sub domain when pointed from the domain to the sub domain. It doesn't work the same as Joomla and I wonder why and how can I solve it?

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by butte » Mon Mar 03, 2014 6:21 am

OC is not a CMS. There are several kinds of (and names of) .ht* files, * is a wildcard for whatever comes after the .ht, such as for group, password, etc.. Wildcards are * for multi-positions, ? for single positions (c* includes c?t and ca?, and those include cat, cot, and cut). So much for what Google knows.

Forwarding and redirection, as such, differ. The masking is akin to forwarding. You may need to find the answer in joomla-land, because it is the CMS and you apparently do not want OC to be independent of it.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by jrjr » Mon Mar 03, 2014 6:35 am

NO! These are separate sites and not related. I just happen to have some Joomla websites and they have NOTHING to do with Open Cart. I was just using them as a reference of what I was trying to accomplish. Joomla and Open Cart sites that I have installed have nothing to do with each other whatsoever!!!

Please, understand that

I know OC is not a content management system. My question is how to make OC behave like I want and I will not find that answer in "joomla-land"

Ok hopefully that is out of the way now.

So, a ,ht file...... lets start simple because this is the first time I have heard this referenced.....
Is the .htaccess file a form of .ht file that your are referring to?

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by butte » Mon Mar 03, 2014 8:07 am

The .htaccess file is one kind of Apache file. For restricted access there is a pair of .htgroup file and .htpasswd file, and there are others, such as a paired .htaclu and .htacl files (which won't work in the presence of a .htaccess file), that are also Apache files. For Apache itself there are other kinds, such as its .htconfig file. Note that ALL of those are .ht*, a standalone file extension, with no name preceding it, NOT name.extension, JUST .ht[extension], nothing more. The wildcard kinds, .ht* or for example .ht????, take in those. Wildcards * and ? have been in use since before DOS, and are essentially the same and mean the same thing on all operating systems, Unix, Linux, CPM, DOS, Windows, and several others. Simple ".ht*" is quicker than spelling out the list of them.

All .htaccess files are alike, same layout and syntax following complicated rules. They can be short or lengthy. There can moreover be more than one upward through the tree, with progressively narrowed control.

That is why you CAN productively look inside your public_html/ root, or domain/ root, or joomla/ root .htaccess file(s) to see exactly how it specifies outcomes that you want to achieve and are accustomed to seeing. There is absolutely no reason why the .htaccess file in an OC root should not be able to reach the same result. In the case of OC you need to be sure that the basedir line properly specifies either store root as / or as a /[store_directory_name]/ (with trailing /), just below the instruction line saying so (near but not at the top of the file).

The initial landing goes to domain., the ensuing ones go to subdomain.domain. instead, raising at least two practical approaches. In admin System / Settings / [Store] / Edit you will find among the tabs, left to right, entries specifying the store itself. You may have the "wrong" name in there, and need to change it for the interim purpose. You can give the subdomain a CNAME record equating subdomain. to domain. so that subdomain. does not show. Allow propagation time for it to set, and again for it to unset when you are done bypassing the OC you are working on ("while [you] fix the first one"). (Where youve shown domain2.domain you may risk or be confusing yourself, so in writing them out try thinking instead of subdomainN.domain or the like.)

Which OC version(s) are involved? You are supposed to start with that. As for outburst, you weren't crystalline at the outset, the rest of us aren't habituated to looking at what you have.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by jrjr » Mon Mar 03, 2014 8:37 am

Nevermind
I guess the short answer is no, Open Cart will not behave in the manner in which I want it to.

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by butte » Mon Mar 03, 2014 9:25 am

Yes it will, period.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by jrjr » Mon Mar 03, 2014 9:40 am

Well, it doesn't. I want it to work with my host's pointing system and it doesn't. In my first post I asked "Can this be corrected in the address configurations that are in the config files?" and never got my question answered. To me those config files directs things to the address contained within. Maybe I used incorrect terminology but I did the best I could.

No easy way to do this from the sounds. Sure it can be made to do it I suppose with file changes maybe but I just want it to work with my hosts pointing(redirection) feature and it doesn't. period

If I choose to use OC then I will have to live with the inconvenience. So far I am in the -find out about it - stage. I like it for the most part and this probably is not a deal breaker.

BTW in answer to your question..... I am using the latest version of OC

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by jrjr » Mon Mar 03, 2014 7:13 pm

For clarification here's my workflow

domain.com
- subdomain1.domain.com (active site containing Open Cart install)
- subdomain2.domain.com (backup site containing Open Cart install)

domain.com contains no files

I redirect (point) domain.com to subdomain1.domain.com using my host's CPanel pointer(redirection) feature. Hence, there are no open cart files and no .htaccess in the domain.com structure to use as a tool for redirection.

My point is that my Joomla installs (just plain old Joomla websites-nothing to do with open cart) work just fine with this approach. Not OC in Joomla, just straight basic Joomla websites. They redirect with my hosts cpanel and the resulting url shows domain.com/page on all pages of the website regardless of where it is pointed - subdomain1.domain.com or subdomain2.domain.com. I have been using this approach for a long time and it just plain works with no file modifications.

Open Cart on the other hand, (just plain OC installs and nothing to do with Joomla) will reflect subdomain1.domain.com in the address bar.

Now, I could place a .htaccess in the empty directory structure of the domain (domain.com) and redirect with that rather than using my CPanel but it eludes me as to how this file would be written to retain the domain.com address structure in the address bar. I know how to redirect with .htaccess. Its the address retention that eludes me.

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by butte » Mon Mar 10, 2014 6:54 pm

Thank you, that clarifies what you have to start with. As it sits (on 03rd, anyway), each subdomain (1, 2) reaches its own OC (active, backup). You want domain to read domain in the address bar but be (re)settable at will to land on either subdomain while it still shows as domain (visitors see domain, not either subdomain by name).

If you put into the empty domain root a new .htaccess, you can utilize the upper several lines in the existing OC .htaccess files, down through and including the basedir. Set the domain's own basedir to match the target OC basedir: /[shop1_directory]/ (WITH leading / AND trailing /). You can later change that to /[shop2_directory]/ in the domain's own .htaccess, OR instead just rename the two OC directories so as to swap them (/shop1/ to /shopx/, then /shop2/ to /shop1/, then /shopx/ to /shop2/, whereupon they are swapped).

Another way is "stealth" in an index.html (in the currently empty root of the domain itself) with an i-frame whose source is one or the other OC.

Either way should do what you want to accomplish. For a few minutes at a time you can tinker with those. Probably the basedir approach is simplest for what you intend.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by jrjr » Mon Mar 10, 2014 8:04 pm

I do know what you are saying but I do not know the syntax for writing the file.
For instance, in my domain that I want to forward if I place a .htaccess file with simply this line:

Code: Select all

Redirect 302 / http://subdomain1.domain.com/
It will redirect to my subdomain but the address bar will reflect the subdomain's address after the landing page. This is known.

Now, with the above in place and working what you are saying I think is to then change the .htaccess file in the subdomain that I am pointing to (subdomain) in order to have the domain's address shown in the address bar but have the subdomains files being used. Correct?

Here are the first few lines of a stock .htaccess file as it is in my subdomain-

Code: Select all

# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>

# SEO URL Settings

RewriteEngine On
RewriteRule ^i([0-9]+)-(.*)$ index.php?route=information/information&information_id=$1 [L]
RewriteRule ^c([0-9_]+)-(.*)$ index.php?route=product/category&path=$1 [L]
RewriteRule ^m([0-9]+)-(.*)$ index.php?route=product/manufacturer/info&manufacturer_id=$1 [L]
RewriteRule ^pp([0-9]+)-(.*)$ index.php?route=product/product&product_id=$1 [L]
RewriteRule ^pm([0-9]+)-m([0-9]+)-(.*)$ index.php?route=product/product&manufacturer_id=$2&product_id=$1 [L]
RewriteRule ^pc([0-9]+)-c([0-9_]+)-(.*)$ index.php?route=product/product&path=$2&product_id=$1 [L]

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_FILENAME} !-l
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
What exactly would I change in this file to accomplish the goal?

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by butte » Mon Mar 10, 2014 9:00 pm

1/ I'm still not seeing OC version.

2/ No, leave the OC .htaccess files as they are, add one for the domain itself (BELOW the OC directories in the tree).

3/ The initial lines of the virgin .htaccess.txt (thus, .htaccess when renamed) for 1.5.5.1 read (with blank lines omitted):

# 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 /

4/ All of those are important. The last one can be rewritten, for the sake of the domain itself, to read:

RewriteBase /shop1_directory/

. . . and with that done, the domain effectively retains its own name while it lives with and as the OC in that position in the tree on the disc. The lines below that one are not needed, the OC .htaccess file(s) take care of those.

5/ The result (stripped of comments but with blank lines reinserted for visual clarity) is:

Options +FollowSymlinks

Options -Indexes

<FilesMatch "\.(tpl|ini|log|txt)">
Order deny,allow
Deny from all
</FilesMatch>

RewriteEngine On
RewriteBase /shop1_directory/
# end it with a blank line where this commented line occurs . . .

6/ If you look carefully you'll see that |txt was added here, the reason is that error.txt is often loaded with sensitive lines and is a "log" file but without a .log file extension. In the full root it protects both OC. You can also add the |txt in the two OC .htaccess files.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by jrjr » Wed Mar 12, 2014 9:37 am

Ok, thanks for that.
I am a little confused though.
When you write....

RewriteBase /shop1_directory/

What exactly is /shop1_directory/ in my circumstance?
Is it my subdomain as in subdomain1.domain.com as shown in my workflow?

I did try this and the landing page worked, with the domain landing page showing.... and subsequent pages were 500 error.

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by jrjr » Tue Mar 18, 2014 3:55 am

Bet you missed this reply!

Newbie

Posts

Joined
Fri Feb 28, 2014 7:28 pm

Post by butte » Wed Mar 19, 2014 8:20 pm

Dinna miss it, hadn't looked for several days. For .htaccess "RewriteBase /shop1_directory/" use the directory location of workflow "subdomain1.domain.com" -- the disc path.

Since the thing apparently lands as you wish but then goes to 500, and since 500 means server confused, try (after making backup of .htaccess) lopping the rewrite rules under your "# SEO URL Settings" rubric. If landing works but 500 stops, then 500 springs from those .

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am
Who is online

Users browsing this forum: No registered users and 44 guests