Forums / General Questions / Why does an extra directory level show up in my url when I'm in my admin area?

Why does an extra directory level show up in my url when I'm in my admin area?

Started by webkat on 16 Mar 2012, 6:08 PM · Views: 1,070

Results 1 to 5 of 5
16 Mar 2012, 6:08 PM
#1
webkat avatar

webkat

Zen Follower

Join Date:
Jan 2012
Location:
New England
Posts:
238
Plugin Contributions:
0

Why does an extra directory level show up in my url when I'm in my admin area?

I've renamed my admin folder, don't worry, I'm only calling it "admin" here for ease of understanding.

When I go to https://www.mysite.com/admin it reloads to https://www.mysite.com/mysitefolder/admin where "mysitefolder" is the folder under public_html in my hosting account where this domain lives. "mysitefolder" is the pageroot for https://www.mysite.com, not a subfolder. So why is it showing up as a subfolder in my site? I've looked at both configuration.php files and the relevant (I think?) lines say:

define('HTTP_SERVER', 'http://mysite.com');
  define('HTTPS_SERVER', 'https://mysite.com');

  // Use secure webserver for checkout procedure?
  define('ENABLE_SSL', 'true');

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
  // these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
  define('DIR_WS_CATALOG', '/');
  define('DIR_WS_HTTPS_CATALOG', '/');

So I know it's not pulling the directories from there... any ideas?

16 Mar 2012, 6:15 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Why does an extra directory level show up in my url when I'm in my admin area?

It's "configure.php", not "configuration.php". They're very different files, for very different purposes, in very different folders.

And, what you posted is not the configure.php file for your admin. If that's what you've got in your admin, then it's not a surprise that you're having lots of problems with your admin.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Mar 2012, 6:33 PM
#3
webkat avatar

webkat

Zen Follower

Join Date:
Jan 2012
Location:
New England
Posts:
238
Plugin Contributions:
0

Re: Why does an extra directory level show up in my url when I'm in my admin area?

Sorry I was misremembering on the name--it was configure.php that I copied the code from. The file I was looking at was the one from the /includes folder. The one from the admin/includes folder contains this:

  define('HTTP_SERVER', 'https://mysite.com');
  define('HTTPS_SERVER', 'https://mysite.com');
  define('HTTP_CATALOG_SERVER', 'http://mysite.com');
  define('HTTPS_CATALOG_SERVER', 'https://mysite.com');

  // secure webserver for admin?  Valid choices are 'true' or 'false' (including quotes).
  define('ENABLE_SSL_ADMIN', 'true');

  // secure webserver for storefront?  Valid choices are 'true' or 'false' (including quotes).
  define('ENABLE_SSL_CATALOG', 'true');

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
  // these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
  $t1 = parse_url(HTTP_SERVER);$p1 = $t1['path'];$t2 = parse_url(HTTPS_SERVER);$p2 = $t2['path'];

  define('DIR_WS_ADMIN', preg_replace('#^' . str_replace('-', '\-', $p1) . '#', '', dirname($_SERVER['SCRIPT_NAME'])) . '/');
  define('DIR_WS_CATALOG', '/');
  define('DIR_WS_HTTPS_ADMIN', preg_replace('#^' . str_replace('-', '\-', $p2) . '#', '', dirname($_SERVER['SCRIPT_NAME'])) . '/');
  define('DIR_WS_HTTPS_CATALOG', '/');

They were both so similar that I didn't figure it was important to show both in the initial post.

16 Mar 2012, 6:46 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Why does an extra directory level show up in my url when I'm in my admin area?

WebKat:

They were both so similar that I didn't figure it was important to show both in the initial post.
Understandable. That's why above the HTTP_SERVER defines there is explanatory text which points out the fact that they're different and must not be mixed up.

Your problem is likely related to defines later in the file. What's defined for DIR_FS_ADMIN and DIR_FS_CATALOG ?

How did the content of these files come to be IN those files? Have you been editing stuff in those files for ANY reason? If so, why? And what?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Mar 2012, 7:01 PM
#5
webkat avatar

webkat

Zen Follower

Join Date:
Jan 2012
Location:
New England
Posts:
238
Plugin Contributions:
0

Re: Why does an extra directory level show up in my url when I'm in my admin area?

I haven't edited the configure.php files--they were populated when I did the install, I think. Here is the other part you asked for:

define('DIR_FS_ADMIN', realpath(dirname(__FILE__) . '/../') . '/');
  //the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
  define('DIR_FS_CATALOG', '/home2/myaccount/public_html/mysitefolder/');