× Here you can get community support related to ReDJ.

How to match part of url and replace rest of

  • originmad
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 8 months ago #4244 by originmad
Hi,

I'm having problem with google that indexes main category pages which dont have menu aliases.

Here is the example situation.

example.com/component/content/category/119-service

i want to redirect this url to single article menu alias like : www.example.com/service

I can do this with exact match

From url : ^/component/content/category/119-service
To url: http://{siteurl}/service{pathltrim /component/content/category/119-service}

But problem is if user type anything different after id(119) it still opens old page (not redirecting).

for example example.com/component/content/category/119-xyza

i want to redirect all possible entry to specific page(example.com/service) after id part but couldnt handle it with regex or anything else.

If you can help i will be glad.

Thank you

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

More
8 years 8 months ago - 8 years 8 months ago #4245 by admin
Hi,
because 119 is the unique identifier of the service, try a rule as follow:
From URL: ^/component/content/category/119-
To URL: {scheme}://{siteurl}/service{queryfull}
Request only: true (checked)

Note that this rule will not work for a service that has nested levels like:

example.com/component/content/category/119-service/section
example.com/component/content/category/119-service/section/another-section

If this is the case, we need to change the rule using a pregmatch macro, to extract the "section" from the original request.

Sincerely,
Luigi
Last edit: 8 years 8 months ago by admin.
The following user(s) said Thank You: originmad

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

  • originmad
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 8 months ago #4246 by originmad
Replied by originmad on topic How to match part of url and replace rest of
Thank you very much for quick response. It did exactly what i wanted.

i searched for deeper section in my site and i think it s ok for now.

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

More
8 years 8 months ago #4247 by admin
U're welcome.

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

Time to create page: 0.115 seconds