Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
Common Questions
 Helicon Tech : Common Questions
Subject Topic: Easy way to convert to lower-case? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
bjimpson
Newbie
Newbie


Joined: 19 August 2004
Location: United States
Online Status: Offline
Posts: 1
Posted: 19 August 2004 at 2:26pm | IP Logged Quote bjimpson

Is there an easy way to rewrite all URLs to be lower case?

I would like to give a 301 Permanent Redurect from, e.g,

www.widgets.com/Products to www.widgets.com/Products etc.

The purpose in this is that search engines think that Products and products may be different pages (which they could very well be).  This could adversely affect PageRank.

Back to Top View bjimpson's Profile Search for other posts by bjimpson
 
Yaroslav
Moderator Group
Moderator Group


Joined: 15 August 2002
Online Status: Offline
Posts: 6467
Posted: 20 August 2004 at 4:52am | IP Logged Quote Yaroslav

Example - write the following rule:

RewriteRule ([^?]*\u.*) /redirect.asp\?$1

This will direct all requests with uppercase characters in it to the redirect.asp page and original URL will be in QueryString. After that you will be able to lowercase this URL and isue a redirect from that page.



__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top View Yaroslav's Profile Search for other posts by Yaroslav Visit Yaroslav's Homepage
 
-KC-
Newbie
Newbie


Joined: 07 October 2004
Location: United States
Online Status: Offline
Posts: 3
Posted: 07 October 2004 at 1:01pm | IP Logged Quote -KC-

No.. that's not gonna work for me I don't think...

I run Froums, and all member tracking and conformation is done through cookies.

Cookies however are case sensitive by the root subdirectory they are made from.

e.g. if someone logs on to mydomain.com/TEST and then clicks a link to some web page at mydomain.com/test they loose their cookie and login.

(Snitz forums if anyone was interested)

It might be possible to change the forum code, but since I have so many pages and forums, I want to make ALL http url requests convert to lower case as far as cookies are concerned.

Is that feasible? or would it drop my Win2K server to it's knee's?

I know it is a cookie problem, and poor planning on my part to use upper case in my subdiretory names and code, but I have thousands of pages over four main sbubdiretories with one 8 years old now.

Any suggestions?



__________________
Back to Top View -KC-'s Profile Search for other posts by -KC-
 
Yaroslav
Moderator Group
Moderator Group


Joined: 15 August 2002
Online Status: Offline
Posts: 6467
Posted: 08 October 2004 at 5:44am | IP Logged Quote Yaroslav

Here is a rule that will direct all requests with any uppercase character to the /redirect.asp page providing original ULR as Query string. Then you may convert URL to lowercase and issue a redirect from the redirect.asp code:

RewriteRule (?![^\u]+$)(.*) /redirect.asp$1

Remember not to issue redirect with uppercase character or you will fall into a loop.

__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top View Yaroslav's Profile Search for other posts by Yaroslav Visit Yaroslav's Homepage
 
-KC-
Newbie
Newbie


Joined: 07 October 2004
Location: United States
Online Status: Offline
Posts: 3
Posted: 08 October 2004 at 10:35am | IP Logged Quote -KC-

Can't we skip the redirect to another page and just make the whole string lower case in one shot and then send it thru?

Thats what I do for stripping out any www. 's in a url, here is the code I use for that.

# Strip out the www. and redirect.
RewriteCond Host: www\.vales\.com
RewriteRule (.*) http\://vales.com$1 [I,R]

Actually, I guess it would get a bit complicated if it just flat made everything lower case because of querystring forms...

Some form fields after the url string ?variable= might indeed need to be capitol letters... idea's?



__________________
Back to Top View -KC-'s Profile Search for other posts by -KC-
 
-KC-
Newbie
Newbie


Joined: 07 October 2004
Location: United States
Online Status: Offline
Posts: 3
Posted: 08 October 2004 at 10:45am | IP Logged Quote -KC-

I have an idea... There are actually only 4 subdirectory names whose case affect my cookies, /MTM2/, /Evo1/, /Evo2/ and /XR/.

All I need to do is the same thing I do to strip out www. right? Look for each of the 4 subs regardless of case, and redirect them with the cases above right?

It doesn't matter if it's all upper, lower, mixed, whatever, just so it is always the same.



__________________
Back to Top View -KC-'s Profile Search for other posts by -KC-
 
Yaroslav
Moderator Group
Moderator Group


Joined: 15 August 2002
Online Status: Offline
Posts: 6467
Posted: 08 October 2004 at 2:32pm | IP Logged Quote Yaroslav

And why you don't want to try my suggestion?



__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top View Yaroslav's Profile Search for other posts by Yaroslav Visit Yaroslav's Homepage
 
BSindia
Newbie
Newbie


Joined: 12 October 2004
Location: India
Online Status: Offline
Posts: 2
Posted: 12 October 2004 at 6:29am | IP Logged Quote BSindia

Yes, that is correct! First try his suggestion and revert back us, if you have any problem, so that we can suggest you any other option!

I feel this suggestion will solve your issue!

 

 



__________________
Cheap web hosting
bsindia.com - Windows 2003
server,ASP.Net,ASP,Miva merchant New,
Professional support, all starting from $3.33/month
Back to Top View BSindia's Profile Search for other posts by BSindia Visit BSindia's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum