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 in Others by Kichu
• 19,040 points
76 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 for more details
https://stackoverflow.com/a/6005511/15282066
answered Feb 14 by narikkadan
• 10,840 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 in Others by Kichu
• 19,040 points
36 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 in Others by narikkadan
• 10,840 points
60 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,210 points
270 views
0 votes
1 answer

Creating SEO friendly urls using htaccess

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

answered Feb 20 in Others by narikkadan
• 10,840 points
31 views
0 votes
1 answer

opencart seo url rewriting

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

answered Feb 20 in Others by narikkadan
• 10,840 points
70 views
0 votes
1 answer

URL Cloaking for SEO?

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

answered Feb 27 in Others by narikkadan
• 10,840 points
41 views
0 votes
1 answer

Create an seo and web accessibility analyzer

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

answered Feb 12 in Others by narikkadan
• 10,840 points
58 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 in Others by narikkadan
• 10,840 points
638 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 in Others by narikkadan
• 10,840 points
151 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP