Mobile app version of vmapp.org
Login or Join
Sims2060225

: Passing Arabic values in parameters results in % spaces I have built an .htaccess clean URL, this part works perfect in my .htaccess: RewriteCond %{THE_REQUEST} /road.phps [NC] RewriteRule . نقفورالثانيفوكاس/

@Sims2060225

Posted in: #Htaccess #Php #UrlEncoding

I have built an .htaccess clean URL, this part works perfect in my .htaccess:

RewriteCond %{THE_REQUEST} /road.phps [NC]
RewriteRule . نقفورالثانيفوكاس/ [R=301,L]
RewriteRule ^نقفورالثانيفوكاس/$ road.php [L]


But this part in the parameters is producing spaces in my navigation:

<?php
$tit = urlencode("نقفورالثاني-فوكاس");
$cap = urlencode("الطريق-للقمة");
?>
<a href = '<?php echo "road.php?title=$tit&caption=$cap" ; ?>'>


Only choosing road.php is working:
www.nikephorosphokas.com/%D9%86%D9%82%D9%81%D9%88%D8%B1%D8%A7%D9%84%D8%AB%D8%A7%D9%86%D9%8A%D9%81%D9%88%D9%83%D8%A7%D8%B3/


(The title is displaying great in Arabic, so this is working)

But with the two parameters, it's resulting in a lot of spaces:
www.nikephorosphokas.com/%D9%86%D9%82%D9%81%D9%88%D8%B1%D8%A7%D9%84%D8%AB%D8%A7%D9%86%D9%8A%D9%81%D9%88%D9%83%D8%A7%D8%B3/%25D9%2586%25D9%2582%25D9%2581%25D9%2588%25D8%25B1%25D8%25A7%25D9%2584%25D8%25AB%25D8%25A7%25D9%2586%25D9%258A%25D9%2581%25D9%2588%25D9%2583%25D8%25A7%25D8%25B3/%25D8%25A7%25D9%2584%25D8%25B7%25D8%25B1%25D9%258A%25D9%2582%25D9%2584%25D9%2584%25D9%2582%25D9%2585%25D8%25A9/


(This is not what I want, so it's NOT working)

This is my complete .htaccess:

RewriteCond %{THE_REQUEST} /road.phps [NC]
RewriteRule . نقفورالثانيفوكاس/ [R=301,L]
RewriteRule ^نقفورالثانيفوكاس/$ road.php [L]

RewriteCond %{THE_REQUEST} /road.php?title=([^&s]+)s [NC]
RewriteRule . نقفورالثانيفوكاس/%1/? [R=301,L]

RewriteCond %{THE_REQUEST} /road.php?title=([^&s]+)&caption=([^&s]+)s [NC]
RewriteRule . نقفورالثانيفوكاس/%1/%2/? [R=301,L]

RewriteRule ^نقفورالثانيفوكاس/([^/]+)/$ road.php?title= [L]
RewriteRule ^نقفورالثانيفوكاس/([^/]+)/([^/]+)/$ road.php?title=&caption= [L]


RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).php [NC]
RewriteRule ^ %1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ .php [L]


I tried adding urlendice or rawurlencode as well, but the result was the same.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sims2060225

1 Comments

Sorted by latest first Latest Oldest Best

 

@Kaufman445

I am pretty sure you have to use PunyCode encoded addresses in .htaccess file. Try to convert arabic values to punycode with a tool such as this one: www.punycoder.com/
I have done it this way for Cyrillic addresses and it worked fine.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme