× Here you can get community support related to Tag Meta.

Problem using RegEx

  • bettabi
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 8 months ago #2236 by bettabi
Problem using RegEx was created by bettabi
Hi!

I would like to set a canonical url using regular expression (but I can't figure it out):

I've tried to set /blog/*$ in url and /attivita/*$ in canonical (see image) but it's not working.
For example, no canonical url in this link: www.skipperclub.it/it/blog/1-maggio-vela-a-capraia.html

Can you help me with this issue?

Thank you!
Attachments:

Please Log in or Create an account to join the conversation.

More
10 years 8 months ago #2237 by admin
Replied by admin on topic Problem using RegEx
Hi,
the canonical field must be an absolute URL. It can contains macros to build it dynamically, but cannot contains regular expressions (as you are trying to do).

Can you tell me which should be the canonical for:

www.skipperclub.it/it/blog/1-maggio-vela-a-capraia.html

I guess:

www.skipperclub.it/it/attivita/1-maggio-vela-a-capraia.html

Right?

Please Log in or Create an account to join the conversation.

  • bettabi
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 8 months ago #2238 by bettabi
Replied by bettabi on topic Problem using RegEx
Yes you're right!

Can you kindly tell me how can I get what I want - if it's possible?

Thank you!

Please Log in or Create an account to join the conversation.

More
10 years 8 months ago - 10 years 8 months ago #2241 by admin
Replied by admin on topic Problem using RegEx
Just set canonical filed as:
http://{siteurl}/${lang}/attivita/${subpath}

And add this to placeholders:
lang={preg_match 1}/^.*\/([^\/]+)\/blog\//i{/preg_match}
subpath={preg_match 1}/\/blog\/(.*\.html)/i{/preg_match}

Not tested, so not sure it works at first try... :)

Kind regards,
Luigi
Last edit: 10 years 8 months ago by admin.

Please Log in or Create an account to join the conversation.

  • bettabi
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 8 months ago #2242 by bettabi
Replied by bettabi on topic Problem using RegEx
Thank you for your help but...

I still can't see canonical url in source code of my page: www.skipperclub.it/it/blog/1-maggio-vela-a-capraia.html

Is the url set correctly?
/blog/*$
Attachments:

Please Log in or Create an account to join the conversation.

  • bettabi
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 8 months ago #2244 by bettabi
Replied by bettabi on topic Problem using RegEx
Any idea?
Please help!
Thanks!

Please Log in or Create an account to join the conversation.

Time to create page: 0.171 seconds