Search code examples
.htaccessmod-rewritecharacterarabic

problem with arabic ( م ) character in .htaccess RewriteRule


I have problem with ( م ) arabic character in .htaccess RewriteRule .

The problem is :

when I open url localhost/site/cat/مرئيات I get error page like this :

screenshoot1

But when I change it to localhost/site/cat/برئيات by changing the ( م ) character or delete it, It work fine like this :

screenshoot2

Other arabic character is work fine so where is the wrong in my case?

My .htaccess file content:

Options None
Options FollowSymLinks
AddDefaultCharset UTF-8
AddType 'text/html; charset=UTF-8' .html
AddCharset UTF-8 .html
RewriteEngine On
RewriteRule ^cat/(.*)/?$ cat.php?title=$1 [NC,L]

Please help and thanks.


Solution

  • I managed to make it work on my localhost by changing the rewriterule to the following:

    RewriteRule ^cat/([^/.]+)$ cat.php?title=$1 [QSA,L]
    

    So it matches any character other than "/" or ".". I'm not quite sure why it didn't accept your version though. Make sure to delete your cache before refreshing!