Jump to content
papadoble151

Remove anchor from url

Recommended Posts

Hello everyone,

 

I need to remove "#" from the url, after applying some filters.

For example, I want the link www.mywebsite.com/trainers#/type1 to be

www.mywebsite/trainers/type1

 

Thanks in advance

 

 

Share this post


Link to post
Share on other sites

I am pretty sure that you can remove a # sign from the url using module like PrestaShop Pretty URLs.

Share this post


Link to post
Share on other sites

i think that it's not possible to remove the # from the url with pretty urls

it's not a matter of this module

  • Like 3

Share this post


Link to post
Share on other sites

Does anyone know how to remove # after the URL? Is it harmful to SEO to have # showing after the URL e.g. http://domain.com/# this only shows the first time i call the address in the browser. Would really appreciate some solution

Share this post


Link to post
Share on other sites

Claudi

 

It is not harmful for your SEO to have a # shown after a URL, therefore I'd recommend leaving it if you were just looking to change it because of SEO.

Share this post


Link to post
Share on other sites

Do we have function to automatically remove any junk or speical characters in URLs in prestashop?

 

Like we have function to remove sql injection when accepting data from form.

Share this post


Link to post
Share on other sites

By default feature of PrestaShop in Preferences>SEO URLs removes the un-necessary characters from the urls. Only products ids will appears after turning it on. Although these IDs don't too much matter for SEO however, if you've requirement to remove them. You can use Pretty URLs Module of 3rd party. 

Share this post


Link to post
Share on other sites

Hi I have similar issue as google bot  can't see the url beyond the hashtag

 

here is the warning from google merchant center

 

(In the URL for all your products you have a "#" sign. For eg. http://xtremewarehouse.com.au/1372-max-s-supersize.html#/size-4kg/flavour-banana/

 
The Google Reviewing software that reviews your data feed doesn't read description in the URL after the "#" symbol which is causing the discrepancy in prices)
 
Any idea what can be done please.

Share this post


Link to post
Share on other sites

Indeed.

 

BUMP !

 

href lang issues arise since the urls in the alternate tags are not identical to the ones with the hashtag since google bot turns a blind eye to everything beyond the hash tag.

 

Solutions (without the use of modules please, I have plenty activated already) are welcome

Share this post


Link to post
Share on other sites

Maybe it could help someone:

I need to replace "#" in url with "?selected_filter=" (to make infinite scroll working with layered navigation), so I changed in blocklayered.php (presta 1.6.1.20)

in line 2877

    $type_filter['values'][$key]['link'] = $categorie_link.'#'.ltrim($parameters, '/');

to

    $type_filter['values'][$key]['link'] = $categorie_link.'?selected_filters='.ltrim($parameters, '/');

in line 3185:

            'current_friendly_url' => ((int)$n == (int)$nb_products) ? '#/show-all': '#'.$filter_block['current_friendly_url'],

to

           'current_friendly_url' => ((int)$n == (int)$nb_products) ? '/show-all': '?selected_filters='.$filter_block['current_friendly_url'],

Try to simply remove "#" from those lines
Infinite scroll in block layered works fine for me now.
 

Share this post


Link to post
Share on other sites

Hello,

I would like to remove everything after and including the # hashtag from our urls on product pages with combinations. This is in Prestashop 1.7.

Prestashop 1.6 doesn't seem to have this problem.

For example, in 1.6, when a user clicks to a product (product page) with combinations the URL is like this:

www.website.com/product-category/67-product.html

However, and I need to fix this, on Prestashop 1.7 the URL is like so:

www.website.com/product-category/67-product.html#/301-product-color

 

This is when the user first comes to page. In PS 1.6 it just has www.website.com/product-category/67-product.html and then once the user picked a combination it would change to www.website.com/product-category/67-product.html#/301-product-color which is fine.

When a user first comes to product page in 1.7 it automatically shows www.website.com/product-category/67-product.html#/301-product-color

How can I get rid of the #/301-product-color when the page is first loaded up?

 

I hope this makes sense.

 

I have the feeling this is really hurting our SEO, as our shops in 1.6 seem to rank very well, however, in 1.7 everything that has a hashtag on the end seems to do poorly as far as SEO is concerned.

Anybody that has any ideas please let me know!

 

Thanks

 

 

 

Share this post


Link to post
Share on other sites

I would ask the same question as before. Why would you like to remove the anchor? Google can perfectly index them....

Share this post


Link to post
Share on other sites

I would like to remove it as well in PS1.7, I believe duplicate contents problem comes up. 

Share this post


Link to post
Share on other sites

in /override/classes/Link.php

I change this and it's ok now. 

        /** return $url . $dispatcher->createUrl('product_rule', $idLang, array_merge($params, $extraParams), $force_routes, $anchor, $idShop);*/
        return $url . $dispatcher->createUrl('product_rule', $idLang, array_merge($params, $extraParams), $force_routes, $idShop);
 

I'm currently testing it.  if there is some news I'll write here. 

Share this post


Link to post
Share on other sites

I found this as well

 

https://stackoverflow.com/questions/49531603/prestashop-1-7-remove-hash-1-size-4-from-url

 

// $anchor = $ipa ? $product->getAnchor((int) $ipa, (bool) $addAnchor) : ''; // <-- Here is the change

  $anchor = '';


  return $url . $dispatcher->createUrl('product_rule', $idLang, array_merge($params, $extraParams), $force_routes, $anchor, $idShop);

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More