Re: Simple SEO URL [support thread]
Basically, we will parse the url to rebuild all $_GET elements, if the link is changed intentionally (heck, you can even do so with the original query string), $_GET will not contain the expected values. But then the user will not gain anything from it, he will get to a page-not-found or an error page depend on the situation. No harm done.
Re: Simple SEO URL [support thread]
Here is the patch on the latest 2.6 code to provide links such as:
Code:
http://localhost/site/index/c2s4s6-vinyl-albums/p6-led-zep-ii
PHP Code:
$ diff Simple_SEO_URL/includes/init_includes/init_ssu.php site/includes/init_includes/init_ssu.php
34,39c34,35
< if ($request_type == 'SSL')
< $catalog_dir = DIR_WS_CATALOG;
< else
< $catalog_dir = DIR_WS_HTTPS_CATALOG;
< $extension = SSU_FILE_EXTENSION;
< $extension = trim($extension);
---
> $catalog_dir = ($request_type == 'SSL') ? DIR_WS_CATALOG : DIR_WS_HTTPS_CATALOG;
> $extension = trim(SSU_FILE_EXTENSION);
47a44
> $file_name = current(explode(SSU_ID_DELIMITER, $mr_parts[$i],2));
49,51c46,48
< if(strstr($mr_parts[$i],'c'.SSU_ID_DELIMITER)){
< $cPath = explode(SSU_ID_DELIMITER, $mr_parts[$i]);
< $_GET['cPath'] = $cPath[count($cPath)-1];
---
> if($file_name[0] == 'c') {
> if(file_get_contents($this->cache_folder.$file_name) !== false)
> $_GET['cPath'] = str_replace('s','_',substr($file_name,1));
53,55c50,52
< elseif(strstr($mr_parts[$i],'p'.SSU_ID_DELIMITER)){
< $products_id = explode(SSU_ID_DELIMITER, $mr_parts[$i]);
< $_GET['products_id'] = $products_id[count($products_id)-1];
---
> elseif($file_name[0] == 'p') {
> if(file_get_contents($this->cache_folder.$file_name) !== false)
> $_GET['products_id'] = substr($file_name,1);
200d196
< $result = 'c'.SSU_ID_DELIMITER.$result.SSU_ID_DELIMITER.$cPath;
201a198
> $result = $file_name.SSU_ID_DELIMITER.$result;
208c205
< return "c$cPath";
---
> return 'c'. str_replace('_','s',$cPath);
226c223
< $result = 'p'.SSU_ID_DELIMITER.$result.SSU_ID_DELIMITER.$products_id;
---
> $result = $file_name.SSU_ID_DELIMITER.$result;
Re: Simple SEO URL [support thread]
Oh, and I forgot, thanks again yellow1912!
Re: Simple SEO URL [support thread]
If you want to keep your URLs ultra simple then you don't actually need to include the full cPath. The only bit that is needed is the final category ID. e.g. if the cPath is 1_2_3_4 then you only need the 4. The full cPath can then be rebuilt from the category ID. This also helps if you move categories around which confuses the heck out of Google.
In fact you don't need the cPath at all except on linked products (and category pages of course).
Regards,
Christian.
Re: Simple SEO URL [support thread]
It's a good idea, will do that on the next release.
Will ZC handles the cPath rebuild, or we must do that on the mod?
Also, it would be interesting to see someone comes up with a proper 301 redirect method that should work in most cases. Being an open source mod, SSU is open for anyone to modify and improve it to suit their needs. And hopefully any code improvement will be posted back here so that everyone can benefit from it.
Expecting more and more code/feature suggestions will come in. And maybe this mod can be incorporated into the new version of ZC, or can be of any help for the developers to build an even better one.
Quote:
Originally Posted by
CJPinder
If you want to keep your URLs ultra simple then you don't actually need to include the full cPath. The only bit that is needed is the final category ID. e.g. if the cPath is 1_2_3_4 then you only need the 4. The full cPath can then be rebuilt from the category ID. This also helps if you move categories around which confuses the heck out of Google.
In fact you don't need the cPath at all except on linked products (and category pages of course).
Regards,
Christian.
Re: Simple SEO URL [support thread]
New version with minor changes in codes:
Change some local params to class params to allow re-use.
Redirect site.com/index.php or site.com/index.php? or site.com/? to site.com
Re: Simple SEO URL [support thread]
Quote:
Originally Posted by
CJPinder
If you want to keep your URLs ultra simple then you don't actually need to include the full cPath.
Not exactly. If you don't have the full cPath, the menus will not show properly, which was a problem of a previous version.
More precisely, you would not have access to menu Level 3 because the engine would not know which path to display.
Steps to reproduce the bug:
1. Click on Level 1:
> the page refresh with Level 1 opened becasue cPath = ID of Level 1
2. Click on Level 2:
> the page refresh with Level 1 closed because cPath = ID of Level 2
Re: Simple SEO URL [support thread]
Quote:
Originally Posted by
skaimauve
Not exactly. If you don't have the full cPath, the menus will not show properly, which was a problem of a previous version.
If you re-read my original post you will see that I said that you can rebuild the full cPath from the category ID.
Regards,
Christian.
Re: Simple SEO URL [support thread]
Quote:
Originally Posted by
yellow1912
Will ZC handles the cPath rebuild, or we must do that on the mod?
You would need to do it on the mod but it is pretty straight forward. The following code will do it...
PHP Code:
$current_category_id = <insert category id here>
$rebuild_categories = array();
zen_get_parent_categories($rebuild_categories, $current_category_id);
$rebuild_categories = array_reverse($rebuild_categories);
$cPath = implode('_', $rebuild_categories);
if (zen_not_null($cPath)) $cPath .= '_';
$cPath .= $current_category_id;
As there is a one-to-one mapping between category IDs and cPaths the process could be cached pretty easily.
Regards,
Christian.
Re: Simple SEO URL [support thread]
No, if I ever decide to do that, I wont use[FONT=monospace] zen_get_parent_categories because it will require mysql query. I will store the category tree in file which can be retrieved later.
Example:
17_19_21 will be stored in file t21
[/FONT]