Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7951109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:27:43+00:00 2026-06-04T02:27:43+00:00

I have a site that I’m building out with php that will allow for

  • 0

I have a site that I’m building out with php that will allow for multi language for content. One part of the site will have business listings. I have SEO friendly urls setup to view these listings, so for example I would have a business listing called “A bar down the street”. The url would look like this:

/listing/a-bar-down-the-street

However lets say there is an Arabic version of this listing, then the name would look like this:

شريط أسفل الشارع

How would I make that into the same url format as the English version but in the language it is currently in? When I tried my function on the Arabic version that turns a string into a seo friendly url it comes back empty.

EDIT:
To clarify further, all I’m looking for is a php function that allows me to turn any string into an SEO friendly url no matter what language the site is in.

EDIT PART 2
Below is the function Im using to rewrite the string to a SEO friendly url. Perhaps you can tell me what I need to add to make it language friendly?

    public function urlTitle($str,$separator = 'dash',$lowercase = TRUE)
    {

        if ($separator == 'dash')
        {

            $search     = '_';
            $replace    = '-';

        }else
        {

            $search     = '-';
            $replace    = '_';

        }

        $trans = array(
                        '&\#\d+?;'              => '',
                        '&\S+?;'                => '',
                        '\s+'                   => $replace,
                        '[^a-z0-9\-_]'          => '',
                        $replace.'+'            => $replace,
                        $replace.'$'            => $replace,
                        '^'.$replace            => $replace,
                        '\.+$'                  => ''
                        );

        $str = strip_tags($str);
        $str = preg_replace("#\/#ui",'-',$str);

        foreach ($trans AS $key => $val)
        {

            $str = preg_replace("#".$key."#ui", $val, $str);

        }

        if($lowercase === TRUE)
        {

            $str = mb_strtolower($str);

        }

        return trim(stripslashes($str));

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:27:45+00:00Added an answer on June 4, 2026 at 2:27 am

    I have found similar discussion in an existing SO discussion. It seems that what you are requesting should be possible “out-of-the-box”.

    I would recommend looking into your webserver config to see what is the problem, there should not be a difference between seo-friendly English urls and any other url-encodable string.

    What webserver are you running?

    UPDATE
    I see that you are only accepting alphanumeric characters:

    '[^a-z0-9\-_]'          => '',
    

    I suspect that may filter out any non-a-z characters and cause the empty return. Or, alternatively, you can try to debug your function to see which of the replace condition causes your content to be wiped-out.

    What you are encountering here is that URLs by default cannot contain any character, browsers in general use encoding to achieve nice-looking multi language URLs.

    See example from link:

    URLs are allowed only a certain set of english letter characters, which includes the numbers, dashes, slashes, and the question mark. All other characters have to be encoded, which applies to non-Latin domain names. If you go to فنادق.com, you will notice that some browsers will decode it and show you فنادق.com but some like Chrome will show you something like this http://www.xn--mgbq6cgr.com/.

    Which means that you can no longer filter your post title and only allow url-valid characters, you need to encode the titles and hope that the browser will render them as you would like.

    Another option would be to use trans-literation, possibly after detection of a browser which is known to not render the url-encoded special characters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one site that is displaying html content that needs to be displayed
I have a site that has 2 DIV tags, one floats left the other
I have a site that will require a login by the users. The client
I have a site that has both Mootools and jQuery present. How will selectivizr
I have a site that has some areas of content that need to be
I have a site that has an admin page (eg admin.php) that is normally
I have a site that operates out of an IFRAME. Is it possible to
I have a site that has a div with content and a navbar (looks
I have one site that I never perused and I might as well redirect
I have a site that allow the user to request a secret report in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.