Hello,
I appreciate you reaching out for assistance. To remove any special characters (excluding letters and numbers) from the part of the link after the /ita/ folder, you can utilize a regex redirection in Rank Math.
Here is the regex code you can use:
/ita/([a-zA-Z0-9]+)
In this regex code:
/ita/
specifies the folder path.
([a-zA-Z0-9]+)
captures any combination of letters and numbers after the /ita/ folder.
You can add this regex code to the Source URLs field in Rank Math’s Redirection feature. Ensure to select the Regex matching type and set the Destination URL as per your requirements.
If you encounter any issues or need further assistance, feel free to let us know. We are here to help!
Thank you for bringing up this concern.
Sources:
How to Redirect to URLs With Trailing Slash » Rank Math
How to Remove a Specific Word From Your Permalinks (URLs) » Rank Math
Solving Redirection Issues Using Rank Math SEO Plugin » Rank Math
How to Edit Your htaccess File Using Rank Math » Rank Math
It’s not clear to me what I should do
Hello,
Unfortunately, Rank Math does not have any feature to update your URLs to remove the hyphen per words.
However, you may try to use and customize this filter to achieve that on your site:
function no_dashes( $slug, $post_ID, $post_status, $post_type ) {
if( $post_type == "post" ) {
$slug = str_replace( '-', '', $slug);
}
return $slug;
}
add_filter( "wp_unique_post_slug", "no_dashes", 10, 4 );
Here’s a guide to adding the code to the website:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Please note that it will work only when you save a post. For new posts, it will work just fine. But for existing posts, you have to go and edit/hit update/save to make it happen. You can remove the condition to apply it to your whole site.
Hope that helps.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.