X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Clean Url first letter (https://forum.x-cart.com/showthread.php?t=67872)

marinvalentin 10-02-2013 10:45 PM

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

totaltec 10-03-2013 03:46 AM

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/

marinvalentin 10-03-2013 04:00 AM

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? :)

totaltec 10-03-2013 04:50 AM

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.

marinvalentin 10-03-2013 07:50 AM

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!

cflsystems 10-03-2013 09:18 AM

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

cheap eyeglasses 10-30-2013 06:41 AM

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?

cflsystems 10-30-2013 08:30 AM

Re: Clean Url first letter
 
http://forum.x-cart.com/showthread.php?t=52342&highlight=lower+clean+url

totaltec 10-30-2013 08:53 AM

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. :-)

cflsystems 10-30-2013 09:16 AM

Re: Clean Url first letter
 
Oh man I didn't even noticed... this feels like an anniversary :)

totaltec 10-30-2013 09:23 AM

Re: Clean Url first letter
 
You have achieved Veteran status! OMG I forgot that level existed! The highest rank I have seen in a while is X-guru, Balinor is the only one I know of that is Veteran.


All times are GMT -8. The time now is 05:35 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.