How to enable arabic slug in htaccess?

前端 未结 2 1099
太阳男子
太阳男子 2021-01-16 04:32

I have a multi-languages website, and I\'m trying to create a friendly URL. In my database, I have the slug field. When the article\'s title is in english t

2条回答
  •  心在旅途
    2021-01-16 04:57

    Most likely the issue is your rewriting rule. It explicitly is crafter such that it only gets applied for requests that consist of only ascii characters, an underscore or a hyphen in the slug part of the URL. That obviously won't match arabic characters in the URL. So you have to change your rule to accept more or less anything expect very special characters:

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^([0-9]+)/([^/]+)/?$ article.php?id_art=$1 [NC,L]
    

提交回复
热议问题