[SEO] MakeURLSafe and the '/' character

For Articles relating to more than one ISC version
grantg
Posts: 112
Joined: Thu Oct 08, 2009 11:01 am

Re: [SEO] MakeURLSafe and the '/' character

Post by grantg »

By my reckoning, if a product name has a dash, it is converted to %252d in the URL. I have now amended my general.php in the lib directory to cater for products with & in the name, I have replaced the & character with 'and'

$val = str_replace("&", "and", $val);

I have also amended the first str_replace function, so that a dash is not converted and is left as a dash. Absolutely no problems at all...yet.
Cupar Garden Centre: CS-Cart Professional 2.2.5 (Converted from ISC 6.0.14 Ultimate)
Online Garden Centre: ISC 6.0.14 Professional
hattieuadt
Posts: 2
Joined: Tue Oct 13, 2009 3:56 pm

Re: [SEO] MakeURLSafe and the '/' character

Post by hattieuadt »

Hepl vietnames

Code: Select all

      $val = str_replace("đ", "d", $val);
products " 3 Bước chuyên sâu điều trị đốm nâu và tàn nhang Omar Sharif Re20 Whiteshift Melano " page not found
cumitham
Posts: 1
Joined: Sat Dec 18, 2010 10:55 am
Location: Vietnam

Re: [SEO] MakeURLSafe and the '/' character

Post by cumitham »

SamX wrote:Thank you!!! to complete this hack for spanish users who wants to add characters like:

á, é, í, ó, ú and ñ

Code: Select all

   function MakeURLSafe($val)
   {
      $val = str_replace("-", "%2d", $val);
      $val = str_replace("+", "%2b", $val);
      $val = str_replace("+", "%2b", $val);
      $val = str_replace("/", "%2f", $val);
       /**        *Spanish Characters    - Start     */
          $val = str_replace("ñ", "n", $val);
          $val = str_replace("á", "a", $val);
          $val = str_replace("é", "e", $val);
          $val = str_replace("í", "i", $val);
          $val = str_replace("ó", "o", $val);
          $val = str_replace("ú", "u", $val);
       /**        *Spanish Characters    - End    */
      $val = urlencode($val);
      $val = str_replace("+", "-", $val);
      return $val;
   }

   /**
    * Convert an already search engine friendly based string back to the normal text equivalent.
    *
    * @param string The search engine friendly version of the string.
    * @return string The normal textual version of the string.
    */
   function MakeURLNormal($val)
   {
      $val = str_replace("-", " ", $val);
      $val = urldecode($val);
      $val = str_replace("{47}", "/", $val);
      $val = str_replace("%2f", "/", $val);
      $val = str_replace("%2e", "/", $val);
      $val = str_replace("%2d", "-", $val);
      $val = str_replace("%2b", "+", $val);
       /**        *Spanish Characters    - Start     */
          $val = str_replace("A%F1", "ñ", $val);
          $val = str_replace("%E1", "a", $val);
          $val = str_replace("%E9", "e", $val);
          $val = str_replace("%ED", "i", $val);
          $val = str_replace("%F3", "o", $val);
          $val = str_replace("%FA", "u", $val);
       /**        *Spanish Characters    - End    */
      return $val;
   }
I register just to thank you for your post. Best wishes for you. ;)
hattieuadt
Posts: 2
Joined: Tue Oct 13, 2009 3:56 pm

Re: [SEO] MakeURLSafe and the '/' character

Post by hattieuadt »

hattieuadt wrote:Hepl vietnames

Code: Select all

      $val = str_replace("đ", "d", $val);
products " 3 Bước chuyên sâu điều trị đốm nâu và tàn nhang Omar Sharif Re20 Whiteshift Melano " page not found
Hepl me!
prospektas
Posts: 4
Joined: Tue Apr 19, 2011 6:33 pm

Re: [SEO] MakeURLSafe and the '/' character

Post by prospektas »

Hi guys, maybe someone will tell how to replace:

%252f to /
%3A to :
%2C to ,
%252b to +
%3D to =
%29 to )
%28 to (
%252d to -
%21 to !
%3F to ?


Thanks a lot !!!
Post Reply