Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Unable To Access Admin In A Subdirectory


blueedge

Recommended Posts

I am trying to create a copy of my store in a subdirectory and then work on creating a new store in the root. I am using a subdirectory for the location of the copy of the store so that I can use an older version of PHP, which the root store currently uses. The main intent is to be able to have access to the order history.

 

The store/catalog of the subdirectory can be access be accessed (subdirectory.mysite.com). That works fine.

 

The issue I’m experiencing is that I am unable to fully access the admin portion in the subdirectory. I can access the admin login page (www.subdirectory.mysite.com/admin/login.php). However, after entering my username and password to access the admin, I am redirected to the admin page of the store in the root directory (http://www.subdirectory.mysite.com');

  define('HTTPS_SERVER', 'http://www.subdirectory.mysite.com');

  define('HTTPS_CATALOG_SERVER', 'https://www.subdirectory.mysite.com');

  define('ENABLE_SSL', 'false');

  define('ENABLE_SSL_CATALOG', 'true');

  define('DIR_FS_DOCUMENT_ROOT', '/home/mysite/public_html/subdirectory');

  define('DIR_WS_ADMIN', '/subdirectory/admin/');

  define('DIR_FS_ADMIN', '/home/mysite/public_html/subdirectory/admin/');

  define('DIR_WS_CATALOG', '/subdirectory/');

  define('DIR_FS_CATALOG', '/home/mysite/public_html/subdirectory');

  define('DIR_WS_IMAGES', 'images/');

  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

  define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');

  define('DIR_WS_INCLUDES', 'includes/');

  define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

  define('DIR_WS_CATALOG_LANGUAGES', DIR_WS_CATALOG . 'includes/languages/');

  define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/');

  define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');

  define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/');

  define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');

 

*db login info*

Link to comment
Share on other sites

Good point, Dan. 

 

While I previously looked in the htaccess file for the subdirectory, I did not look in the htaccess for subdirectory/admin, which has password protection. 

 

I just now modified subdirectory/admin/.htaccess from:

AuthUserFile "/home8/mysite/.htpasswds/public_html/admin/passwd"

 

To:

AuthUserFile "/home8/mysite/.htpasswds/public_html/subdirectory/admin/passwd"

 

With that change it seems I'm making a little progress.

 

Previously I could only get to the subdirectory admin login page (www.subdirectory.mysite.com/admin/login.php) but after entering my username and password, I would be redirected to the admin of the root (www.mysite/admin/index.php) and would be logged into the root admin. I could not alter the URL to go to any other the page in the subdirectory admin other than the login page. If I would try to manually insert the subdomain into the URL (such as www.subdomain.mysite.com/admin/index.php), I would be redirect back to the root directory admin (www.mysite/admin/index.php).

 

However, now after modifying the subdirectory/admin/.htaccess file, it still redirects to the admin in the root (www.mysite.com/admin/index.php) but now I can alter the URL to go to the subdirectory admin (www.subdomain.mysite.com/admin/index.php). All of the links on the subdirectory/admin pages refer to the root admin but now I can alter the URL by inserting "subdirectory" and reach the www.subdirecotry.mysite.com/admin) pages.

 

I reviewed the htaccess file the subdirectory but did not see any that stood out (although I'm not very knowledgeable). The rewrite base is to the root (RewriteBase /) which would be the root of the subdirectory.

 

As I mentioned, the catalog side is fine. All of the links on the catalog of the subdirectory point to the subdirectory. Given that the rewrite works for the catalog, I thought that the problem would not be in the htaccess of the subdomain but in the configure.php of the subdirectory admin.

Link to comment
Share on other sites

I'm no expert on directory stuff (or probably anything else for that matter) but I don't think you can use www. with a subdomain....try it without the www. in your configuration file.

 

Dan

Link to comment
Share on other sites

I appreciate your help, Dan. However, I'm not sure that is it because the includes/configure.php includes the www and the catalog works fine. For whatever reason, the links in the admin of the subdirectory still point to the root admin.

Link to comment
Share on other sites

You can use www with a subdomain, but you have to have that set up in dns records.  However, you really don't see www used with subdomains.  I can't think of one off hand.  You also have to have the subdomain in dns.  Most hosting packages will do that when you create the sub domain.  There are some handy domain tools at http://www.dnsstuff.com/tools

 

Can you see your dns records?

I'm not really a dog.

Link to comment
Share on other sites

I didn't see anything wrong with your configuration.php.   Maybe it would help if you posted your .htaccess file or provided a link to look at.

 

Dan

Link to comment
Share on other sites

If it works for your catalog side okay then you're good on dns records.  One thing is you should have all your admin pages as https even for the HTTP_SERVER.  Otherwise, you're subject to MTM with passwords.

I'm not really a dog.

Link to comment
Share on other sites

As suggested, I have added the  cookie path or cookie domain info to the subdirectory admin/includes/configure.php file. However, I did not notice a change.

 

Somehow, the admin of the the subdirectory is "linked" to the root directory but the catalog of the subdirectory is not. In preparing to redo the root, I placed the root in maintenance mode and deleted all of the oscommerce files and folders in the root. Now, the admin of the subdirectory also displays maintenance mode but the catalog of the subdirectory does not. I don't understand.

Link to comment
Share on other sites

You could try removing your .htaccess file temporarily and see what effect it has....that should tell you if the problem is in that file or not.

 

Dan

Link to comment
Share on other sites

The htaccess file of the root has been replaced with a extremely basic version.

 

I guess I can try to start removing sections of the subdirectory htaccess file (after making a copy). What is really strange is that I don't see anything in the subdirectory htaccess that specifically addresses the admin of the subdirectory but yet, the admin of the subdirectory points to the root but the catalog of the subdirectory points to the subdirectory (as it should).

Link to comment
Share on other sites

@@blueedge Is this a sub-directory or a sub-domain? If it is a sub-directory the following should be set to the root directory

  define('HTTP_CATALOG_SERVER', 'http://www.root.com');

  define('HTTPS_CATALOG_SERVER', 'https://www.root.com');

If it's a sub-domain then you shouldn't list the sub-directories name so entries should be like this

define('DIR_WS_ADMIN', '/admin/');

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Sorry, Jack_mcs. I should have been more clear. It is a sub-domain, not a folder. 

 

I did notice the error regarding the admin location in the previous post of the admin/includes/configure file. However, even with the correction, I still can't access the admin (although the catalog section is accessible.) All references on the admin section point to the root domain, not the sub-domain, while all references on the sub-domain catalog point to the sub-domain. (The sub-domain admin displays the favicon of the root domain, while the sub-domain catalog displays the favicon of the sub-domain.)

 

The current admin/includes/configure files looks like this:

 

  define('HTTP_SERVER', 'http://www.sub-domain.mysite.com');
  define('HTTPS_SERVER', 'https://www.sub-domain.mysite.com');
  define('HTTP_CATALOG_SERVER', 'http://www.sub-domain.mysite.com');
  define('HTTPS_CATALOG_SERVER', 'https://www.sub-domain.mysite.com');
  define('ENABLE_SSL', 'true');  
  define('ENABLE_SSL_CATALOG', 'true');
  define('DIR_FS_DOCUMENT_ROOT', '/home/mysite/public_html/sub-domain/');
  define('DIR_WS_ADMIN', '/admin/');
  define('DIR_FS_ADMIN', '/home/mysite/public_html/sub-domain/admin/');
  define('DIR_WS_CATALOG', '/');
  define('DIR_FS_CATALOG', '/home/mysite/public_html/sub-domain/');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
  define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
  define('DIR_WS_CATALOG_LANGUAGES', DIR_WS_CATALOG . 'includes/languages/');
  define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/');
  define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');
  define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/');
  define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');
 
  define('HTTP_COOKIE_DOMAIN', 'www.sub-domain.mysite.com');  
  define('DIR_WS_HTTP_CATALOG', '/');                           
 
* db info  here*
Link to comment
Share on other sites

Does it work if there is a file name in the url, like https://subdomain,com/admin/login.php

 

What happens if you set both of the ssl options to false?

 

What version of oscommerce is this for? The admin configure file is not the same in all versions.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I copied everything from the root domain to the sub-domain. After changing the htaccess and configure files, I was able to get the sub-domain catalog to work. (There remains no issue with the sub-domain catalog). Initially, I could get to the sub-domain/admin/login page. However, after logging in, I would be automatically redirected to the admin of the root domain. After some more fidgeting around, I was able to get to sub-domain admin pages by manually altering the URL (for example, changing www.mysite.com/admin/orders.php to www.sub-domain.mysite.com/admin/orders.php). However, all of the links/references on the sub-domain admin page were for be for the root admin domain pages.

 

Thinking that was good enough for now (because I only want the sub-domain for order history and to start work on the new site in the root domain) I "blasted" the root domain version of the site. Now, when I try to access the sub-domain admin login page, the URL still reads www.sub-domain.mysite.com/admin/login.php but a "page not found" is displayed referencing info from the root domain. 

 

I tried changing the SSL setting to false but with no change. (Actually, I do not have SSL for the sub-domain but it is password protected.)

 

It is a very, very old store. Unfortunately, I do not know the osc version.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...