After I import data to my site, the url aliases have / at the end, when I visit that Url alias I faced with page not found, I tried to edit one of them manually and when I removed the slash from end I could see that node correctly, my question is how can I remove all slashes / from all aliases ?


one solution is using Views Bulk Operation, create a view and with using run arbitrary Php option in VBO try to remove all / from aliases,

something like ( I didn't test this )

  $entity->path['alias'] = rtrim($entity->path['alias'] ,'/');

and another and faster solution is using MYSQL TRIM in order to update in database go to phpadmin my admin ( or mysql command line ) and run below command

 UPDATE `url_alias` SET `alias`= TRIM(TRAILING '/' FROM `alias` ) 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy