Zen Cart Logo
Forums / All Other Contributions/Addons / Ceon URI Mapping v4.x

Ceon URI Mapping v4.x

Views: 451,795

Results 2,281 to 2,300 of 2,454
5 Sep 2018, 3:58 PM
#2281
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Ceon URI Mapping v4.x

Nick1973:

1031 to 1038

if (isset($_SERVER['HTTP_REFERER']) && preg_match("~^".HTTP_SERVER."~i", $_SERVER['HTTP_REFERER']) ) {
//if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], str_replace(array('http://', 'https://'), '', HTTP_SERVER) ) ) {
$link= $_SERVER['HTTP_REFERER'];
} else {
$link = zen_href_link(FILENAME_DEFAULT);
}
$_SESSION['navigation'] = new navigationHistory;
}


Is this store hosted on a Windows machine? Does the HTTP_SERVER value found in includes/configure.php use a backslash (\) instead of a forwards slash (/) to identify a sub-directory for the store?
5 Sep 2018, 11:20 PM
#2282
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

mc12345678:

Is this store hosted on a Windows machine? Does the HTTP_SERVER value found in includes/configure.php use a backslash () instead of a forwards slash (/) to identify a sub-directory for the store?

It's on a Linux Server however the domain name is not live and uses something like http://00.00.00.000/~MYWEBSITE to get to it

6 Sep 2018, 1:37 AM
#2283
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon URI Mapping v4.x

Nick1973:

It's on a Linux Server however the domain name is not live and uses something like http://00.00.00.000/~MYWEBSITE to get to it

And somewhere in ~MYWEBSITE is there a v? Possibly just after the tilde?

6 Sep 2018, 6:04 AM
#2284
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

mc12345678:

And somewhere in ~MYWEBSITE is there a v? Possibly just after the tilde?

No there isn't

6 Sep 2018, 10:42 AM
#2285
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon URI Mapping v4.x

Nick1973:

No there isn't

Because of the use of the tilde in the HTTP_SERVER string, recommend modifying:

if (isset($_SERVER['HTTP_REFERER']) && preg_match("~^".HTTP_SERVER."~i", $_SERVER['HTTP_REFERER']) ) {       //if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], str_replace(array('http://', 'https://'), '', HTTP_SERVER) ) ) {         $link= $_SERVER['HTTP_REFERER'];       } else {         $link = zen_href_link(FILENAME_DEFAULT);       }       $_SESSION['navigation'] = new navigationHistory;     }

To:

if (isset($_SERVER['HTTP_REFERER']) && preg_match("~^".preg_quote(HTTP_SERVER, "~")."~i", $_SERVER['HTTP_REFERER']) ) {       //if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], str_replace(array('http://', 'https://'), '', HTTP_SERVER) ) ) {         $link= $_SERVER['HTTP_REFERER'];       } else {         $link = zen_href_link(FILENAME_DEFAULT);       }       $_SESSION['navigation'] = new navigationHistory;     }

I don't see any other instance on the catalog side where this style of preg_match is used against that specific string. I didn't look on the admin side. Note, that based on the error log that the page to be loaded was a page not found page. Why that particular direction was chosen I do not know based on what has been provided or what has been performed to generate URIs, but the above would prevent running into a clash. An alternative to adding in the preg_quote function is to modify the two uses of the tilde to say a non-uri like character, perhaps a semi-colon (;) or some other "odd" character.

6 Sep 2018, 12:28 PM
#2286
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon URI Mapping v4.x

mc12345678:

Because of the use of the tilde in the HTTP_SERVER string, recommend modifying:

if (isset($_SERVER['HTTP_REFERER']) && preg_match("~^".HTTP_SERVER."~i", $_SERVER['HTTP_REFERER']) ) { //if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], str_replace(array('http://', 'https://'), '', HTTP_SERVER) ) ) { $link= $_SERVER['HTTP_REFERER']; } else { $link = zen_href_link(FILENAME_DEFAULT); } $_SESSION['navigation'] = new navigationHistory; }

> 
> To:
> ```
if (isset($_SERVER['HTTP_REFERER']) && preg_match("~^".preg_quote(HTTP_SERVER, "~")."~i", $_SERVER['HTTP_REFERER']) ) {       //if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], str_replace(array('http://', 'https://'), '', HTTP_SERVER) ) ) {         $link= $_SERVER['HTTP_REFERER'];       } else {         $link = zen_href_link(FILENAME_DEFAULT);       }       $_SESSION['navigation'] = new navigationHistory;     }

I don't see any other instance on the catalog side where this style of preg_match is used against that specific string. I didn't look on the admin side. Note, that based on the error log that the page to be loaded was a page not found page. Why that particular direction was chosen I do not know based on what has been provided or what has been performed to generate URIs, but the above would prevent running into a clash. An alternative to adding in the preg_quote function is to modify the two uses of the tilde to say a non-uri like character, perhaps a semi-colon (;) or some other "odd" character.
I neglected to also state that the specific error encountered in includes/functions/functions_general.php when trying whatever uri on the store was attempted is not directly associated with this plugin as it would have occurred regardless of being installed or not. The cause of getting a page not found error may have been a result of some aspect of its installation (possibly incomplete), incorrect use, or other some other factor, but there has not been sufficient information provided to identify why a page not found response was provided.

Generally speaking when using Zen Cart, it is expected that the uri to the store would be a "full" uri, not one using an ip address/temp folder. There are other threads in the forum where this is discussed and it is not necessarily associated with this plugin. I encourage seeking assistance with this aspect in either an existing thread directly related to the issue or by beginning a new one. Note that while this forum contains a lot of useful information that there are many Internet search tools outside of it that may find related discussions better than the forum's search tool. The recent recommendation of others is to add Zen Cart to the end of any such search.

7 Sep 2018, 8:04 AM
#2287
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

mc12345678:

I neglected to also state that the specific error encountered in includes/functions/functions_general.php when trying whatever uri on the store was attempted is not directly associated with this plugin as it would have occurred regardless of being installed or not. The cause of getting a page not found error may have been a result of some aspect of its installation (possibly incomplete), incorrect use, or other some other factor, but there has not been sufficient information provided to identify why a page not found response was provided.

Generally speaking when using Zen Cart, it is expected that the uri to the store would be a "full" uri, not one using an ip address/temp folder. There are other threads in the forum where this is discussed and it is not necessarily associated with this plugin. I encourage seeking assistance with this aspect in either an existing thread directly related to the issue or by beginning a new one. Note that while this forum contains a lot of useful information that there are many Internet search tools outside of it that may find related discussions better than the forum's search tool. The recent recommendation of others is to add Zen Cart to the end of any such search.

Yes totally understand what you are saying but any professional web developer WILL NOT put a url live until it is absolutely completed, and plus there is the problem of google picking up incorrect url's, especially if the site is large and each url has to be generated manually as in the free version of CEON SEO URL's. This is a situation which could in some cases take more than one day, and in which case by that time the google crawler could have then picked up the standard zen cart url. Which then poses a problem as it then means the zen url may then appear in the google search results instead of the CEON URL. That can then take weeks or even months to fix in some cases.

Most professional Web Developers these days develop locally through tools such as MAMP and run PHP and MYSQL on their local machine. Partly because it is faster and partly because of the issues outlined above. Putting a site under a live url while under development can cause endless headaches with SEO later on, which is why there is a need to develop this way. Hence the requirement for 'SOME' modules to work in those kinds of environments and/or under temp url's on a testing environment.

I already use google to do searches and add Zen Cart in that search request to find answers as you are right, there are other places where answers can be found.

7 Sep 2018, 8:34 AM
#2288
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

Does the latest release have all the files in it for a complete installation or is there a requirement to have a previous version installed?

7 Sep 2018, 8:38 AM
#2289
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

Nick1973:

Yes totally understand what you are saying but any professional web developer WILL NOT put a url live until it is absolutely completed, and plus there is the problem of google picking up incorrect url's, especially if the site is large and each url has to be generated manually as in the free version of CEON SEO URL's. This is a situation which could in some cases take more than one day, and in which case by that time the google crawler could have then picked up the standard zen cart url. Which then poses a problem as it then means the zen url may then appear in the google search results instead of the CEON URL. That can then take weeks or even months to fix in some cases.

Most professional Web Developers these days develop locally through tools such as MAMP and run PHP and MYSQL on their local machine. Partly because it is faster and partly because of the issues outlined above. Putting a site under a live url while under development can cause endless headaches with SEO later on, which is why there is a need to develop this way. Hence the requirement for 'SOME' modules to work in those kinds of environments and/or under temp url's on a testing environment.

I already use google to do searches and add Zen Cart in that search request to find answers as you are right, there are other places where answers can be found.

I tried your fix and it gave me the same issue, plus it broke the front end.

Essentially are you saying it will work once the website is given a live URL?

7 Sep 2018, 8:43 AM
#2290
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,866
Plugin Contributions:
7

Re: Ceon URI Mapping v4.x

I cast an eye over this thread but get dizzy with the details.

I would say that back in the day it was this mod that required me to use virtual hosts for local development work as detailed in my previous posts. No other method (alias) would work.

Long ago I updated this code for php7 and other bits, and to keep it alive posted it on Github.

I see someone has posted a "new" version in the plugins.
This I have not compared to mine so I cannot vouch for it.

I know mine works....so maybe you should compare it.

7 Sep 2018, 8:52 AM
#2291
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

torvista:

I cast an eye over this thread but get dizzy with the details.

I would say that back in the day it was this mod that required me to use virtual hosts for local development work as detailed in my previous posts. No other method (alias) would work.

Long ago I updated this code for php7 and other bits, and to keep it alive posted it on Github.

I see someone has posted a "new" version in the plugins.
This I have not compared to mine so I cannot vouch for it.

I know mine works....so maybe you should compare it.

Well I have four domain names on the verge of going live which have exactly the same installations on them. I gave them a look over and have realised one of those can actually go into a live status and it wouldn't take me too long to generate the URL's on that particular domain name, which wouldn't cause too many issues. So I am going to push it live, however if the problem remains I will take it offline again then will have a look at your version.

7 Sep 2018, 9:30 AM
#2292
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

mc12345678:

I neglected to also state that the specific error encountered in includes/functions/functions_general.php when trying whatever uri on the store was attempted is not directly associated with this plugin as it would have occurred regardless of being installed or not. The cause of getting a page not found error may have been a result of some aspect of its installation (possibly incomplete), incorrect use, or other some other factor, but there has not been sufficient information provided to identify why a page not found response was provided.

Generally speaking when using Zen Cart, it is expected that the uri to the store would be a "full" uri, not one using an ip address/temp folder. There are other threads in the forum where this is discussed and it is not necessarily associated with this plugin. I encourage seeking assistance with this aspect in either an existing thread directly related to the issue or by beginning a new one. Note that while this forum contains a lot of useful information that there are many Internet search tools outside of it that may find related discussions better than the forum's search tool. The recent recommendation of others is to add Zen Cart to the end of any such search.

I've now pushed one of the domain names live and still the problem of a blank installation check page exists. So obviously its nothing to do with the tilde.

7 Sep 2018, 10:25 AM
#2293
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon URI Mapping v4.x

Nick1973:

I've now pushed one of the domain names live and still the problem of a blank installation check page exists. So obviously its nothing to do with the tilde.
So you're saying that the error generated is still:

[04-Sep-2018 16:53:54 UTC] Request URI: /~MYWEBSITEDIRECTORY/, IP address: 00.00.00.000
#1  preg_match() called at [/home/MYWEBSITEDIRECTORY/public_html/includes/functions/functions_general.php:1031]
#2  zen_back_link() called at [/home/MYWEBSITEDIRECTORY/public_html/includes/templates/template_default/templates/tpl_page_not_found_default.php:54]
#3  require(/home/MYWEBSITEDIRECTORY/public_html/includes/templates/template_default/templates/tpl_page_not_found_default.php) called at [/home/MYWEBSITEDIRECTORY/public_html/includes/templates/venturezen/common/tpl_main_page.php:179]
#4  require(/home/MYWEBSITEDIRECTORY/public_html/includes/templates/venturezen/common/tpl_main_page.php) called at [/home/vgd/public_html/index.php:97]

[04-Sep-2018 16:53:54 UTC] PHP Warning:  preg_match(): Unknown modifier 'v' in /home/MYWEBSITEDIRECTORY/public_html/includes/functions/functions_general.php on line 1031
7 Sep 2018, 10:37 AM
#2294
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

torvista:

I cast an eye over this thread but get dizzy with the details.

I would say that back in the day it was this mod that required me to use virtual hosts for local development work as detailed in my previous posts. No other method (alias) would work.

Long ago I updated this code for php7 and other bits, and to keep it alive posted it on Github.

I see someone has posted a "new" version in the plugins.
This I have not compared to mine so I cannot vouch for it.

I know mine works....so maybe you should compare it.

I've managed to try your version and it works!

7 Sep 2018, 10:37 AM
#2295
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon URI Mapping v4.x

torvista:

I cast an eye over this thread but get dizzy with the details.

I would say that back in the day it was this mod that required me to use virtual hosts for local development work as detailed in my previous posts. No other method (alias) would work.

Long ago I updated this code for php7 and other bits, and to keep it alive posted it on Github.

I see someone has posted a "new" version in the plugins.
This I have not compared to mine so I cannot vouch for it.

I know mine works....so maybe you should compare it.
I know I had compared the two which was where I found that changes had been made that prevented operation in php versions less than 7.x and also that the work done to use the ZC 1.5.5 notifier in zen_href_link and subsequently ensure the bread-crumbs had the rewritten uri were not adopted.

7 Sep 2018, 10:45 AM
#2296
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

mc12345678:

I know I had compared the two which was where I found that changes had been made that prevented operation in php versions less than 7.x and also that the work done to use the ZC 1.5.5 notifier in zen_href_link and subsequently ensure the bread-crumbs had the rewritten uri were not adopted.

I have a working version sort of which is the main thing. It looks like some modifications appear to be missing though from some files that aren't included unless they are in the installation instructions, so I am going to work through the list in a moment and come back to this thread.

7 Sep 2018, 10:47 AM
#2297
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

torvista:

I cast an eye over this thread but get dizzy with the details.

I would say that back in the day it was this mod that required me to use virtual hosts for local development work as detailed in my previous posts. No other method (alias) would work.

Long ago I updated this code for php7 and other bits, and to keep it alive posted it on Github.

I see someone has posted a "new" version in the plugins.
This I have not compared to mine so I cannot vouch for it.

I know mine works....so maybe you should compare it.

Is this important? Its in 1.5.5e/includes/templates/MYTEMPLATE/html_header.php

//steve bof CEON uri mapping
        //CEON uri mapping produces a canonical link with no extra parameters: so no "?" after the url.
        //To create the alternate urls for hreflang use, for all pages (apart from the home page), '&language=' is appended to the canonical url. This gets a page not found (in the Google Search Console) as the "&" needs to be a "?" as there are no other parameters.
        //Since the $canonicalLink is already created, it needs to be checked for the presence of a "?". If so, ok, if not use the "?" instead of "&".
        //echo '<link rel="alternate" href="' . ($this_is_home_page ? zen_href_link(FILENAME_DEFAULT, 'language=' . $key, $request_type) : $canonicalLink . '&language=' . $key) . '" hreflang="' . $key . '" />' . "\n";
        echo '<link rel="alternate" href="' . ($this_is_home_page ? zen_href_link(FILENAME_DEFAULT, 'language=' . $key, $request_type) : $canonicalLink . (strpos($canonicalLink, '?') ? '&' : '?') . 'language=' . $key) . '" hreflang="' . $key . '" />' . "\n";//steve as per https://github.com/zencart/zencart/pull/1314/files
  }
  // EOF hreflang for multilingual sites

Just it breaks my site and I get a white page when I try to load the home page.

7 Sep 2018, 10:51 AM
#2298
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon URI Mapping v4.x

Nick1973:

Is this important? Its in 1.5.5e/includes/templates/MYTEMPLATE/html_header.php

//steve bof CEON uri mapping
//CEON uri mapping produces a canonical link with no extra parameters: so no "?" after the url.
//To create the alternate urls for hreflang use, for all pages (apart from the home page), '&language=' is appended to the canonical url. This gets a page not found (in the Google Search Console) as the "&" needs to be a "?" as there are no other parameters.
//Since the $canonicalLink is already created, it needs to be checked for the presence of a "?". If so, ok, if not use the "?" instead of "&".
//echo '<link rel="alternate" href="' . ($this_is_home_page ? zen_href_link(FILENAME_DEFAULT, 'language=' . $key, $request_type) : $canonicalLink . '&language=' . $key) . '" hreflang="' . $key . '" />' . "\n";
echo '<link rel="alternate" href="' . ($this_is_home_page ? zen_href_link(FILENAME_DEFAULT, 'language=' . $key, $request_type) : $canonicalLink . (strpos($canonicalLink, '?') ? '&' : '?') . 'language=' . $key) . '" hreflang="' . $key . '" />' . "\n";//steve as per https://github.com/zencart/zencart/pull/1314/files
}
// EOF hreflang for multilingual sites

> 
> Just it breaks my site and I get a white page when I try to load the home page.

In what way does it break your site? Ie. what is in the error message?

It was determined to be important in some way which is why it was added.
7 Sep 2018, 11:01 AM
#2299
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon URI Mapping v4.x

Nick1973:

I've now pushed one of the domain names live and still the problem of a blank installation check page exists. So obviously its nothing to do with the tilde.

The error message likely was the same as identified by wmorris where (at least) the file YOUR_ADMIN/includes/classes/class.CeonURIMappingInstallationCheck.php line 2173 uses the null coalesce operator of ?? (available first in PHP 7.0) in:

$path = $old_file_or_dir['file'] ?? $old_file_or_dir['dir'];

was used instead of the pre-PHP 7.0 release:

$path = isset($old_file_or_dir['file']) ? $old_file_or_dir['file'] : $old_file_or_dir['dir'];
7 Sep 2018, 11:35 AM
#2300
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Ceon URI Mapping v4.x

mc12345678:

The error message likely was the same as identified by wmorris where (at least) the file YOUR_ADMIN/includes/classes/class.CeonURIMappingInstallationCheck.php line 2173 uses the null coalesce operator of ?? (available first in PHP 7.0) in:

$path = $old_file_or_dir['file'] ?? $old_file_or_dir['dir'];

> 
> was used instead of the pre-PHP 7.0 release:
> ```
$path = isset($old_file_or_dir['file']) ? $old_file_or_dir['file'] : $old_file_or_dir['dir'];

Ok I have a full working version now. It took a bit of working on but I am there with it. It came together with a mixture of the files submitted for download and the files suggested by torvista

I will try and pull it all together and submit an update for download.