Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Clean Url first letter

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-02-2013, 10:45 PM
 
marinvalentin marinvalentin is offline
 

Newbie
  
Join Date: Oct 2013
Posts: 4
 

Default Clean Url first letter

Hello,

How do i change the link http://store.com/Product-Name with http://store.com/product-name

I've tried this method but didn't work
__________________
X-Cart v4.6
Reply With Quote
  #2  
Old 10-03-2013, 03:46 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Clean Url first letter

Of course you can manually change them to lower case. If you want the change to be automatic when you create a new product you will need to use JavaScript.

Personally, I don't see any seo benefit or hindrance using uppercase.

Can you explain what you are trying to accomplish exactly? Are you wanting lowercase to be automatic when creating a URL, or are you wanting to rewrite all your URLS to lowercase?

http://www.seoverflow.com/redirect-uppercase-urls-to-lowercase/
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #3  
Old 10-03-2013, 04:00 AM
 
marinvalentin marinvalentin is offline
 

Newbie
  
Join Date: Oct 2013
Posts: 4
 

Default Re: Clean Url first letter

First of all thank you for your response.
I know i can manually change them but i need to know if is there any solution to make them auto with lowercase.

I want the lowercase to be automatic when creating a URL and i want to rewrite all URLS to all products that i already have in shop.
How can i do that?
__________________
X-Cart v4.6
Reply With Quote
  #4  
Old 10-03-2013, 04:50 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Clean Url first letter

Here is a way to do it with .htaccess or httpd.conf:
http://www.askapache.com/htaccess/rewrite-uppercase-lowercase.html

You could write a mysql query that would change all the entries in the database using the Lower() function:
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_lower

To get it to be lowercase from now on automatically:
http://stackoverflow.com/questions/154862/convert-javascript-string-to-be-all-lower-case

Edit /common_files/js/check_clean_url.js
Look at line 69 and find:
to_field.value = from_field.value.replace(/[\&]/g, '-and-').replace(/[^a-zA-Z0-9._-]/g, '-').replace(/[-]+/g, '-').replace(/-$/, '');

Change it to:
to_field.value = from_field.value.replace(/[\&]/g, '-and-').replace(/[^a-zA-Z0-9._-]/g, '-').replace(/[-]+/g, '-').replace(/-$/, '').toLowerCase();;

All we have done is added ".toLowerCase();" to the end of the JavaScript expression. This will work for all new products you create that don't have a clean url value. Or if you remove the Clean URL and make some change to the product name than it will rewrite it for you.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following 2 users thank totaltec for this useful post:
marinvalentin (10-03-2013), tartaglia (10-04-2013)
  #5  
Old 10-03-2013, 07:50 AM
 
marinvalentin marinvalentin is offline
 

Newbie
  
Join Date: Oct 2013
Posts: 4
 

Default Re: Clean Url first letter

This :

to_field.value = from_field.value.replace(/[\&]/g, '-and-').replace(/[^a-zA-Z0-9._-]/g, '-').replace(/[-]+/g, '-').replace(/-$/, '').toLowerCase();;

works for me

Thank you!
__________________
X-Cart v4.6
Reply With Quote
  #6  
Old 10-03-2013, 09:18 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,191
 

Default Re: Clean Url first letter

This is XC bug to me, I am sure QT will call it improvement

It has been like this since Clean URLs was first introduced. I am not sure why it was decided to just copy the words from the title and not make them all lowercase to begin with.

The js solution above will get you by only when you create product or modify it in admin. If you are importing products or do auto populate Clean URLs form maintenance page this will not work. The php script involved still outputs the words as they are - so capital letters.... You need to change the outcome in include/func/func.clean_url.php as well
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #7  
Old 10-30-2013, 06:41 AM
 
cheap eyeglasses cheap eyeglasses is offline
 

Senior Member
  
Join Date: Oct 2010
Posts: 143
 

Default Re: Clean Url first letter

Quote:
ou need to change the outcome in include/func/func.clean_url.php as well

how to do then?
Reply With Quote
  #8  
Old 10-30-2013, 08:30 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,191
 

Default Re: Clean Url first letter

http://forum.x-cart.com/showthread.php?t=52342&highlight=lower+clean+url
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
totaltec (10-30-2013)
  #9  
Old 10-30-2013, 08:53 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Clean Url first letter

Steve, congratulations on your 10,000 post! This was it.

That other thread is proof that this forum needs better search capabilities. Otherwise you would only have 5,000 posts.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
cflsystems (10-30-2013)
  #10  
Old 10-30-2013, 09:16 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,191
 

Default Re: Clean Url first letter

Oh man I didn't even noticed... this feels like an anniversary
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following 2 users thank cflsystems for this useful post:
aim (10-30-2013), totaltec (10-30-2013)
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:32 AM.

   

 
X-Cart forums © 2001-2020