Jump to content

Using friendly url's the text box keeps modifying the syntax entered.


The Smoking Gun

Recommended Posts

I am setting up my first category and using the option for SEO friendly urls, and when i enter the url verbatim, it changes the '.''s to '-''s and truncates the page name in to the new url in that text box meant for us to supply the url we prefer to display.

Currently the site I am working with is TOPS in it's primary and secondary keywords, and places 1-2 and 3 in most Google searches for those products, and I do not want to upset this delicate balance i have achieved for this client, over two years ago and have her site fall off the face of Google.

For instance, when another client site was placing only on the first page, and this contradicts the post stating using keyword page names is OVER SEO and frowned, it is not, because after doing just that, his site fell out of sight, for about two weeks, but once Google "got it" that the pages it could no longer find were (my mistake in this respect) not 301 re-directs, which is how I "should" have tried this, those pages came back up and consistently place in the first three positions for most of HIS keywords.

So you understand why this "presto-chango" is not conducive to my intentions.

Is this a result of something in my settings/configurations? or is there possibly an error in the rewrite engine instructions that is generated upon install from the blank .htaccess file we are asked to create during the install?

Please advise a to why i cannot get past this text entry box without what is types in it being changed.

Would you need a screen shot of the entry i am attempting and what it changes to before i even save the category?

I must say that the documentation for this is very poor and highly generalized, and Wiki leaves way too much unsaid, if someone were to take the time to crate a full blown "manual", the support demands here would likely be reduced significantly, as you would not need to spend so much time answering questions such as these, when simple instructions would suffice, if they existed.

I READ the SEO friendly urls page, but nothing prepared me for the dots to be changed to dashes, and dashes where these are placed are invalid urls and sure to be ditched to the last page in Google search results!

This is not a complaint, but instead a suggestion? Insight? Take it as you will!

Thanks for any assistance!
TSG!

UPDATE: to put it more accurately... I copy from the site the original url, and paste it no problem, but since the opportunity is there, when I try to EDIT that initial url entry, the dots just disappear and there are not even a space where they were and the the slashes in that path aer what change to dashes instead, I got it mixed up when i tinitially entered this.

Again thanks for any assistance!

Link to comment
Share on other sites

This is normal. PrestaShop changes all spaces, dots and other symbols to dashes, so that the .htaccess rules PrestaShop writes will work. For example, in the following rewrite rule you can see that only the underscore character, letters and numbers and the dash character can be used, otherwise the rewriting won't work:

RewriteRule ^([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2.jpg [L,E]



I'm not sure why PrestaShop chose to do friendly URLs this way, but they must have had their reasons. It is unfortunate that your other shopping cart uses other symbols in the URLs. To fix this issue isn't easy. You could try changing [_a-zA-Z0-9-] to [_a-zA-Z0-9-.] above and change line 335 of classes/Validate.php from:

return empty($link) OR preg_match('/^[_a-z0-9-]+$/ui', $link);



to:

return empty($link) OR preg_match('/^[_a-z0-9-.]+$/ui', $link);



and then change line 1885 of admin/tabs/AdminProducts.php from:

value="'.htmlentities($this->getFieldValue($obj, 'link_rewrite', $language['id_lang']), ENT_COMPAT, 'UTF-8').'" onkeyup="updateFriendlyURL();" onchange="updateFriendlyURL();" /> *



to:

value="'.htmlentities($this->getFieldValue($obj, 'link_rewrite', $language['id_lang']), ENT_COMPAT, 'UTF-8').'" /> *



I can't guarantee it will work though.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...