urlencode和mod_rewrite斜杠

时间:2016-08-09 14:40:55

标签: php apache .htaccess url mod-rewrite

我的urlencode和链接有问题。当我的链接有" /"在产品名称中,让我们说我的网址坏了。我使用urlencode,我也有一个mod_rewrite链接。让我们说对于nume $produs['Nume_Prod']我的名字里面有一个斜线,我的网址会中断。例如,此链接无效http://onyboutique.ro/Rucsacuri/Rucsac%2fghiozdan%20dama%20negru%20cu%20alb%20Scotti/。在解码时,它只显示ghiozdan dama negru cu alb Scotti而不是Rucsac/ghiozdan dama negru cu alb Scotti

<a href="/'.urlencode($produs['Nume_Categ']).'/', urlencode($produs['Nume_Prod']), '/" data-id="'.$produs['ID_Produs'].'">Products</a>


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^-]*)/([^-]*)/$ /detalii_produs.php?cat=$1&nume=$2 [L,B] 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1 [R=301,L] 

0 个答案:

没有答案