Need help with some macros
-
internetix
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 12
-
Thank you received: 0
-
-
10 years 2 months ago #2978
by internetix
Hi Luigi,
I am trying to figure out a way to setup a redirect.
I want to redirect a bunch of joomla articles from the core joomla router SEF that includes the "menu/submenu" inside URL to another URL that works without the menu and submenu. Let me better explain it below
FROM:
www.site.com/menu-name/submenu-name/89-article-title
TO:
www.site.com/projects/article-title
* Inside the "from" url, basically i can have the entire menu and submenu structure in url (2 or 3 levels deep) + the article ID. So i just want to remove everything ... and just keep the article title and redirect it to something like
www.site.com/projects/article-title
How can i setup a redirect this way ?
Thanks !!!
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
10 years 2 months ago #2979
by admin
Yes,
the redirect rule is possible. But I have a question before. Do the target URL exists? I mean, after redirection, the URL will be
www.site.com/projects/article-title, if I call this URL now, do the pae exists?
Let me know...
Please Log in or Create an account to join the conversation.
-
internetix
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 12
-
Thank you received: 0
-
-
10 years 2 months ago #2991
by internetix
Yes, the old and the new URL's both exists.
Basically we are building a new website on our dev server and we changed the url structure for articles, switching away from the "default" joomla SEF router where article url inherit the "menu/submenu/" structure
Thanks !
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
10 years 2 months ago #2993
by admin
Try this rule:
From URL: ^/menu-name/submenu-name/
To URL: {scheme}://{siteurl}/projects/{preg_match 1}/\/menu-name\/submenu-name\/[0-9]+-([^\/]+)/i{/preg_match}
Request only: true (checked)
Kind regards,
Luigi
Please Log in or Create an account to join the conversation.
-
internetix
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 12
-
Thank you received: 0
-
-
10 years 2 months ago #2994
by internetix
Thanks for the tip Luigi but i think you misunderstood me
"menu-name" and "submenu-name" are dynamic values provided by Joomla SEF router and those are the actual menu hierarchy
Think about this way:
By default the joomla article URL (default SEF) is constructed with menu hierarchy into URL, so an actual URL to one article will look like:
www.site.com/menu-name/submenu-name/89-article-title
I want to redirect that URL logic to the one below
www.site.com/projects/article-title
Basically, redirect the core joomla SEF router logic (menu/submenu/id-article-title) to my custom one (/projects/article-title)
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
10 years 2 months ago - 10 years 2 months ago #2995
by admin
Yes,
and you must create a rule for each /menu-name/submenu-name/ as indicated, just replacing menu-name and submenu name with real names. It is not possible to create only one rule to match all (and only) menu/submenu. Example:
From URL: ^/cooking/pizza/
To URL: {scheme}://{siteurl}/projects/{preg_match 1}/\/cooking\/pizza\/[0-9]+-([^\/]+)/i{/preg_match}
Request only: true (checked)
Hope this is clear now.
Last edit: 10 years 2 months ago by admin.
Please Log in or Create an account to join the conversation.
Time to create page: 0.179 seconds