If this is your first visit, check our documentation. To post, register or login.
Forums / Currencies & Sales Taxes, VAT, GST, etc. / Lowercase URLs and Currencies

Lowercase URLs and Currencies

Started by redspinnaker on 15 Feb 2017, 4:40 AM · Views: 2,162

Results 1 to 6 of 6
15 Feb 2017, 4:40 AM
#1
redspinnaker avatar

redspinnaker

New Zenner

Join Date:
Oct 2010
Posts:
50
Plugin Contributions:
0

Lowercase URLs and Currencies

The website is http://lotusmoonjewellery.com which is set up with zc1.5.5d and Ceon-URI-Mapping-4.5.2.

The .htaccess file in the root directory includes code to force URI to lowercase:

### beginning of section  THIS SECTION TO FORCE URI TO LOWERCASE
# AS PER simonholywell-force-lowercase-urls-rewrite-php AND stackoverflow questions 26032665
RewriteBase /
# force url to lowercase if upper case is found
RewriteCond %{REQUEST_URI} [A-Z] [OR]
RewriteCond %{QUERY_STRING} [A-Z]
# ensure it is not a file on the drive first
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule (.*) rewrite-strtolower.php?rewrite-strtolower-url=$1 [QSA,L]
### end of section 

The problem occurs when we switch currencies, and we get a 404 error,
"http://lotusmoonjewellery.com/?currency=EUR&main_page=index"
with the comment,

"Error 404 - Not Found
The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance."

This is expected of course, with the currency "EUR" being in uppercase.
(in fact if we edit the uri to read "http://lotusmoonjewellery.com/?currency=eur&main_page=index" then the page is properly found, and with the correct currency).

We're hoping someone can suggest a quick fix to this problem?

15 Feb 2017, 7:13 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Lowercase URLs and Currencies

That can't/shouldn't be the entire htaccess file otherwise where is the ceon associated code? (if posted please obscure your admin directory if present).

Also, why force everything to lowercase instead of just ignoring the case? Seems like extra "work" and problems like the above.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

15 Feb 2017, 7:46 AM
#3
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Lowercase URLs and Currencies

RedSpinnaker:

We're hoping someone can suggest a quick fix to this problem?

The quick fix is don't do it. :)

Seriously though, do you have a business reason for doing this?

Domain names are case insensitive, and the parameters that follow are generally case sensitive for good reason, so mussing with them is usually a bad idea.

Just my 2cents

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

15 Feb 2017, 4:23 PM
#4
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Lowercase URLs and Currencies

RedSpinnaker:

The website is http://lotusmoonjewellery.com which is set up with zc1.5.5d and Ceon-URI-Mapping-4.5.2.

The .htaccess file in the root directory includes code to force URI to lowercase:

beginning of section THIS SECTION TO FORCE URI TO LOWERCASE

AS PER simonholywell-force-lowercase-urls-rewrite-php AND stackoverflow questions 26032665

RewriteBase /

force url to lowercase if upper case is found

RewriteCond %{REQUEST_URI} [A-Z] [OR]
RewriteCond %{QUERY_STRING} [A-Z]

ensure it is not a file on the drive first

RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule (.*) rewrite-strtolower.php?rewrite-strtolower-url=$1 [QSA,L]

end of section


That is not quite what the stackover solution suggested and your .htaccess directives, as they are, will never work.

Seems nobody tested the .htaccess change on the site.

I tested using:
http: //lotusmoonjewellery  . com/sterling-Silver-agate-Ring-101501
(spacing is intentional to prevent indexing of this post)

and got the same 404 error. No upper case -> lower case rewriting at all.


The stackoverflow suggestion is using just:

RewriteBase /

force url to lowercase if upper case is found

RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) rewrite-strtolower.php?rewrite-strtolower-url=$1 [QSA,L]


Which might work, depending upon your PHP code.

I would also wonder "why" the need for this rewriting as it does seem to be useless code.

The learning is in the doing.

Potent Products

15 Feb 2017, 5:09 PM
#5
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Lowercase URLs and Currencies

Website Rob:

That is not quite what the stackover solution suggested and your .htaccess directives, as they are, will never work.

Seems nobody tested the .htaccess change on the site.

I tested using:
http: //lotusmoonjewellery . com/sterling-Silver-agate-Ring-101501
(spacing is intentional to prevent indexing of this post)

and got the same 404 error. No upper case -> lower case rewriting at all.

The stackoverflow suggestion is using just:

RewriteBase /

force url to lowercase if upper case is found

RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) rewrite-strtolower.php?rewrite-strtolower-url=$1 [QSA,L]

> 
> Which might work, depending upon your PHP code.
> 
> I would also wonder "why" the need for this rewriting as it does seem to be useless code.

About as useful as an outdoor refrigerator at the South Pole. I'd get rid of it. URL's are case insensitive.

20 years a Zencart User

16 Feb 2017, 12:51 AM
#6
redspinnaker avatar

redspinnaker

New Zenner

Join Date:
Oct 2010
Posts:
50
Plugin Contributions:
0

Re: Lowercase URLs and Currencies

Website Rob:

I tested using:
http: //lotusmoonjewellery . com/sterling-Silver-agate-Ring-101501
(spacing is intentional to prevent indexing of this post)
and got the same 404 error. No upper case -> lower case rewriting at all.

I would also wonder "why" the need for this rewriting

Thanks for the quick replies which are much appreciated :)

Actually our problem is resolved, the "quick fix" being to upload the file "rewrite-strtolower.php" referred to in the above, and which we had overlooked when we upgraded the site! :P

Rob, the upper case -> lower case rewriting should now work, if you would like to recheck.

As for the biz reason, it was simply that all the site URLs were previously written in "title" case and are now all lowercase.
While the URLs may be case insensitive, someone needs to inform Google who were reporting every uri in duplicate :p