0

I know that there is a lot of questions like mine, and I hope that you do not down vote my question, because I have been struggling for almost a day without any solution, and hoping that someone here can help me.

I am developing a multilingual website, when the user enters an Arabic title, then automatically the urlkey will have Arabic letters.

My .htaccess file is rewriting all the English url's without any issue, but when there is Arabic letters, then the page is breaking and I am getting a 404 Not Found Page

Find below my .htaccess file content, and I hope that you can help me

# -------------------------------------------
# | Safe URL                                |
# -------------------------------------------
Options +FollowSymLinks
Options All -Indexes
RewriteEngine On

# -------------------------------------------
RewriteRule ^home/([a-z]+)$                      index.php?lang=$1                                      [L,NC]
RewriteRule ^home                                   index.php                                               [L,NC]

{Tries Goes Here}
RewriteRule ^([a-z]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$                              get-page-contents.php?lang=$1&key1=$2&key2=$3&%{QUERY_STRING}           [L,NC]
RewriteRule ^([a-z]+)/([a-zA-Z0-9-]+)$                                              get-page-contents.php?lang=$1&key1=$2&%{QUERY_STRING}                   [L,NC]

# -------------------------------------------
RewriteCond %{REQUEST_URI} !^/(.*)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

ErrorDocument 404 /404.html

As you can see in my .htaccess file, I have written the line {Tries Goes Here}, that is where I have tried the below lines, each at a time and did not worked

RewriteRule ^([a-z]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$            get-page-contents.php?lang=$1&key1=$2&key2=$3&key3=$4&%{QUERY_STRING} [L,NC]
RewriteRule ^([a-z]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([أ-يa-zA-Z0-9٠-٩_.-]+)$    get-page-contents.php?lang=$1&key1=$2&key2=$3&key3=$4&%{QUERY_STRING} [L,NC]
RewriteRule ^([a-z]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9%-]+)$         get-page-contents.php?lang=$1&key1=$2&key2=$3&key3=$4&%{QUERY_STRING}   [L,NC]
RewriteRule ^([a-z]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9%-]+)$         get-page-contents.php?lang=$1&key1=$2&key2=$3&key3=$4&%{QUERY_STRING}   [L,NE]

Click Here for the working page, without URL Rewrite:

Click Here for the not working page, with URL Rewrite:

Mario Rawady
  • 871
  • 7
  • 17

1 Answers1

0

From this answers How to enable arabic slug in htaccess?

Try this rule :

RewriteRule ^([a-z]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([^/]+)$    get-page-contents.php?lang=$1&key1=$2&key2=$3&key3=$4&%{QUERY_STRING} [L,NE]
Mohammed Elhag
  • 4,272
  • 1
  • 10
  • 18
  • Weird, I passed through this question, but never realized that he is using `^/` in the last part of the URL. Anw thank you! – Mario Rawady Mar 02 '18 at 18:18