Kareem JO
Kareem JO

Reputation: 191

Mod Rewrite and Arabic characters

I currently have the following rules in my .htaccess file that work perfectly for the English site.

RewriteEngine On
RewriteRule ^index.html$ index.php [L]
RewriteRule ^/?([0-9a-zA-Z_-]+)/?$ rewrite.php?param1=$1 [L]
RewriteRule ^/?([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)/?$ rewrite.php?param1=$1&param2=$2 [L]
RewriteRule ^/?([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)/([^/]+)/?$ rewrite.php?param1=$1&param2=$2&param3=$3 [L]

But, on the Arabic website, this throws a "404" error.

Examples that work:

http://www.mysitedomain.xyz/work/website/pages/goals-and-objectives
http://www.mysitedomain.xyz/work/website/solutions/banking

Examples that DO NOT work:

http://www.mysitedomain.xyz/work/website/pages/الاهداف
http://www.mysitedomain.xyz/work/website/solutions/بنوك

Any idea how to fix that?

Thanks

Upvotes: 0

Views: 1005

Answers (2)

Álvaro González
Álvaro González

Reputation: 146540

Given your URL layouts, I don't think you really need to be so specific. You probably just want to split on slashes:

RewriteEngine On
RewriteRule ^index.html$ index.php [L]
RewriteRule ^/?([^/]+)/?$ rewrite.php?param1=$1 [L]
RewriteRule ^/?([^/]+)/([^/]+)/?$ rewrite.php?param1=$1&param2=$2 [L]
RewriteRule ^/?([^/]+)/([^/]+)/([^/]+)/?$ rewrite.php?param1=$1&param2=$2&param3=$3 [L]

Upvotes: 3

ameenulla0007
ameenulla0007

Reputation: 2683

in place of ([0-9a-zA-Z_-]+) this utilize (.*), for any content

Upvotes: 0

Related Questions