0

i have a .htaccess file with the following code:

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule /(.*)\.html article.php?title=$1

to convert my url from article.php?title=xxxx to article/xxxx.html

url contains arabic and english...

so when i enter this url

article/تسريب-أولى-صور-هاتف-LG-G4s-الجديد.html

its working fine but when i visit another article with the url

article/CloneApp-نقل-برامجك-المفضلة-بكامل-إعدادتها-من-ويندوز-إلى-اخر-نقرة-زر.html

not working: Objet non trouvé!

what is the problem (different between them?) why the first works and the second not!

thanks alot in advance.

Yassine Addi
  • 47
  • 1
  • 8
  • Where does the "not working: Objet non trouvé!" error come from? Is that an Apache error? Make a screenshot. Error.log. Your RewriteRule doesn't handle either case, btw. `/(.*)` wouldn't match `/article/(.*)`. – mario Jul 08 '15 at 02:29
  • Objet non trouvé! L'URL demandée n'a pas pu être trouvée sur ce serveur. La référence sur la page citée semble être erronée ou perimée. Nous vous prions d'informer l'auteur de cette page de cette erreur. Si vous pensez qu'il s'agit d'une erreur du serveur, veuillez contacter le webmestre. Error 404 localhost Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8 – Yassine Addi Jul 08 '15 at 02:45
  • Speak in english please, we cannot understand you. – n099y Jul 08 '15 at 02:48
  • i post everything with english .. only the title of the article because its the source of problem – Yassine Addi Jul 08 '15 at 02:50
  • What is the comment above then ? Objet non trouvé! L'URL demandée n'a pas pu être trouvée sur ce serveur. La référence sur la page citée semble être erronée ou perimée. Nous vous prions d'informer l'auteur de cette page de cette erreur. Si vous pensez qu'il s'agit d'une erreur du serveur, veuillez contacter le webmestre. – n099y Jul 08 '15 at 02:54
  • it is the error that i get when opening the url up – Yassine Addi Jul 08 '15 at 02:57
  • yes but im beginner in htaccess ... i try it but i cant make it correctly – Yassine Addi Jul 08 '15 at 03:01

1 Answers1

2

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:

RewriteRule ^([0-9]+)/([^/]+)/?$ article.php?id_art=$1 [NC,L]

Taken from this question asking a similar thing How to enable arabic slug in htaccess?

Hope this helps.

Community
  • 1
  • 1
n099y
  • 414
  • 2
  • 16