Site maintenance: Sun 15 Nov, from 12:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / General Questions / base href and canonicalLink have extra directory in urls...

base href and canonicalLink have extra directory in urls...

Started by webkat on 3 Mar 2012, 6:45 AM · Views: 1,103

Results 1 to 5 of 5
3 Mar 2012, 6:45 AM
#1
webkat avatar

webkat

Zen Follower

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

base href and canonicalLink have extra directory in urls...

The html_header.php of my site says this:

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" />
<?php if (isset($canonicalLink) && $canonicalLink != '') { ?>
<link rel="canonical" href="<?php echo $canonicalLink; ?>" />
<?php } ?>

Which outputs this into the pages:

<base href="http://opalessenceshop.com/opalessenceshop/" />
<link rel="canonical" href="http://opalessenceshop.com/opalessenceshop/index.php?main_page=shopping_cart" />

Those extra /opalessenceshop/ directories should not be there. the correct urls are

<base href="http://opalessenceshop.com/" />
<link rel="canonical" href="http://opalessenceshop.com/index.php?main_page=shopping_cart" />

I'm not sure exactly how to edit the html_header.php file to correct this... help?

3 Mar 2012, 8:07 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: base href and canonicalLink have extra directory in urls...

That's because you've edited your /includes/configure.php file and stuffed '/opalessenceshop/' into your DIR_WS_CATALOG when it should just be '/'.

.
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.

3 Mar 2012, 6:57 PM
#3
webkat avatar

webkat

Zen Follower

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

Re: base href and canonicalLink have extra directory in urls...

Hmm.. I'm not entirely convinced that that isn't something the installer put in there during the reinstall I did, since I can't see why I would do that... but I changed them in the configure.php files (both of them) and it is still showing up. Do I need to go into the database to change it?

3 Mar 2012, 7:01 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: base href and canonicalLink have extra directory in urls...

No. It's ONLY taken from the settings in your configure.php file.
And the only reason the installer would put the extra foldername in there is if you told it to, or if the install happened in that folder originally, and maybe later you moved it without changing the file to match the new folder location.

So, your edits probably aren't saving because the file is read-only. You can't save/upload changes to a file that's read-only. Make it writable first.

.
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.

3 Mar 2012, 9:12 PM
#5
webkat avatar

webkat

Zen Follower

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

Re: base href and canonicalLink have extra directory in urls...

I had changed the file permissions to 755 but it was still showing up in the view source... so I used SSH to get in and edited the files directly on the server, and it worked! Whew. That was bugging me! Thanks for your help.