PHP Convert String to SEO Friendly Url For Bengali Language Type

0 votes

I wanted to covert the string into a friendly url

 function seo_url( $string, $separator = '-' )
 {
   $accents_regex = '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i';
   $special_cases = array( '&' => 'and', "'" => '');
   $string = mb_strtolower( trim( $string ), 'UTF-8' );
   $string = str_replace( array_keys($special_cases), array_values( $special_cases), $string );
   $string = preg_replace( $accents_regex, '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) );
   $string = preg_replace("/[^a-z0-9]/u", "$separator", $string);
   $string = preg_replace("/[$separator]+/u", "$separator", $string);
   return $string;
 } 
 I used this code for that It worked for english but not working for bengali language 
Feb 12, 2022 in Others by Kichu
• 19,040 points
1,130 views

1 answer to this question.

0 votes
$string = preg_replace("/[^a-z0-9]/u", "$separator", $string);  change the regex in this line of code
$string = preg_replace("/[^\p{L}\p{M}]/u", "$separator", $string); try this instead and it will work
answered Feb 14, 2022 by narikkadan
• 63,600 points

Related Questions In Others

0 votes
0 answers

SEO friendly url using php

I wanted to use php to make ...READ MORE

Feb 18, 2022 in Others by Kichu
• 19,040 points
953 views
0 votes
1 answer

Using .htaccsess Generator URL Friendly SEO PHP

Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase / # skip all ...READ MORE

answered Feb 27, 2022 in Others by narikkadan
• 63,600 points
595 views
0 votes
1 answer

Where is the documentation to refer for coinbase api integration of Etherium coin currency in php?

Hey there! Please refer to the following ...READ MORE

answered Jan 25, 2019 in Others by Omkar
• 69,220 points
844 views
0 votes
1 answer

Creating SEO friendly urls using htaccess

its just a simple step just use ...READ MORE

answered Feb 20, 2022 in Others by narikkadan
• 63,600 points
631 views
0 votes
1 answer

opencart seo url rewriting

first of all to do this you ...READ MORE

answered Feb 20, 2022 in Others by narikkadan
• 63,600 points
888 views
0 votes
1 answer

URL Cloaking for SEO?

You might be interested in Google's improved Flash ...READ MORE

answered Feb 27, 2022 in Others by narikkadan
• 63,600 points
467 views
0 votes
1 answer

Create an seo and web accessibility analyzer

there are some tools which  are already ...READ MORE

answered Feb 12, 2022 in Others by narikkadan
• 63,600 points
445 views
0 votes
1 answer

Generator URL Friendly SEO PHP with .htaccess

Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase / # skip all ...READ MORE

answered Feb 14, 2022 in Others by narikkadan
• 63,600 points
4,451 views
0 votes
1 answer

Laravel 8 routes to controllers. SEO friendly URL structure

use regex to match the slugs  again use ...READ MORE

answered Feb 17, 2022 in Others by narikkadan
• 63,600 points
1,464 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP