1,105,197 Community Members

uppercase to lowercase url's

Member Avatar
dedoo
Newbie Poster
3 posts since May 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi all,

newbie question here...

Is there a simple solution to rewrite my urls with capital letters to all lowercase?

i.e.

www.url.com/Test.html

to

www.url.com/test.html

I'm building a directory and the url's are rewritten but keep the uppercase letters right now. I would like to change that to all lowercase.

can this be done with a mod rewrite rule? what should I add to my .htaccess file to make it work?

Thanks
DD

Member Avatar
msaqib
Junior Poster in Training
91 posts since Sep 2004
Reputation Points: -3 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 
RewriteEngine on 
RewriteMap upper2lower int:tolower 
RewriteRule ^/(.*)$ /${upper2lower:$1}

Amnot sure if it will work or not. You can read the full post here...
http://balajin.net/blog/archives/2005/10/07/using_mod_rewrite_to_convert_u.html

Member Avatar
dedoo
Newbie Poster
3 posts since May 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 
RewriteEngine on 
RewriteMap upper2lower int:tolower 
RewriteRule ^/(.*)$ /${upper2lower:$1}

Amnot sure if it will work or not. You can read the full post here...
http://balajin.net/blog/archives/2005/10/07/using_mod_rewrite_to_convert_u.html

I am getting a 500 error when I add this to my .htaccess file

# Protect files
<Files ~ "^(.*)\.(inc|inc\.php|tpl|sql)$">
  Order deny,allow
  Deny from all
</Files>

# Protect directories
<Files ~ "^(backup|files|images|include|lang|libs(/.+)?|temp(/.+)?|templates(/.+)?|javascripts(/.+)?)$">
  Order deny,allow
  Deny from all
</Files>

# Disable directory browsing
Options -Indexes

# Follow symbolic links in this directory
Options +FollowSymLinks

# Override PHP settings that cannot be changed at runtime
# (If your server supports PHP settings via htaccess you can comment following two lines off)
# php_value register_globals   0
# php_value session.auto_start 0

# Customized error messages
# ( If you are running in a subfolder please add it, example: "directory/index.php?httpstatus=404" )
ErrorDocument 404 index.php?httpstatus=404

# Set the default handler
DirectoryIndex index.php

# URL rewrite rules
<IfModule mod_rewrite.c>
   
   RewriteEngine On
   
   ## Details Link Page Rewrite##
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule (.*)fishing/link-(.*).html$ detail.php [QSA,NC]

   ## Pagination Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule (.*)page-(\d+)\.html$  $1/?p=$2 [PT,NC]

   ## Category redirect
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^(.*)$ index.php [QSA,L]

</IfModule>

any idea where and how I should add this?

Member Avatar
guybrush
Light Poster
25 posts since Dec 2005
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

case is not a factor considered by search engines in rating websites. Its more of a site usibility issue than a SEO one.

Member Avatar
newonlineinfo
Junior Poster in Training
96 posts since Jul 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi all,

newbie question here...

Is there a simple solution to rewrite my urls with capital letters to all lowercase?

i.e.

www.url.com/Test.html

to

www.url.com/test.html

I'm building a directory and the url's are rewritten but keep the uppercase letters right now. I would like to change that to all lowercase.

can this be done with a mod rewrite rule? what should I add to my .htaccess file to make it work?

Thanks
DD

Hi,

Why you want this to be done? For SEs? :!:

Member Avatar
Dani
The Queen of DaniWeb
20,551 posts since Feb 2002
Reputation Points: 1,356 [?]
Q&As Helped to Solve: 927 [?]
Skill Endorsements: 203 [?]
Administrator
Featured
Sponsor
 
0
 

Aside from the SEs, my guess would be to accomidate for typos. Or ... because he used to use capital letters and now he wants to use all lowercase because it's easier to type in and such, and he doesn't want the old URLs to be broken.

Member Avatar
newonlineinfo
Junior Poster in Training
96 posts since Jul 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Aside from the SEs, my guess would be to accomidate for typos. Or ... because he used to use capital letters and now he wants to use all lowercase because it's easier to type in and such, and he doesn't want the old URLs to be broken.

Hi,

Both http://www.asdf.com/ASD.php and http://www.asdf.com/asd.php is equal :) So no borken URLs :mrgreen:

Member Avatar
rijas_mk
Newbie Poster
1 post since Jun 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 
RewriteEngine on 
RewriteMap upper2lower int:tolower 
RewriteRule ^/(.*)$ /${upper2lower:$1}

Amnot sure if it will work or not. You can read the full post here...
http://balajin.net/blog/archives/2005/10/07/using_mod_rewrite_to_convert_u.html

You are almost correct, but you have to place the code in httpd.conf and not in the .htaccess (Internal server error will occure)

You can place the code as follows in httpd.conf

<virtualhost.....
<bunch of host stuff>

RewriteEngine on
RewriteMap lowercase int:tolower
RewriteCond $1 [A-Z]
RewriteRule ^/(.*)$ /${lowercase:$1} [R=301,L]

</VirtualHost>

Please check
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#InternalAPI

Member Avatar
Mahdi007
Newbie Poster
1 post since Dec 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

You are almost correct, but you have to place the code in httpd.conf and not in the .htaccess (Internal server error will occure)

You can place the code as follows in httpd.conf

<virtualhost.....
<bunch of host stuff>

RewriteEngine on
RewriteMap lowercase int:tolower
RewriteCond $1 [A-Z]
RewriteRule ^/(.*)$ /${lowercase:$1} [R=301,L]

</VirtualHost>

Please check
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#InternalAPI

Thanks, this helped greatly where mod_speling would not.

Member Avatar
redesignunit
Posting Pro in Training
434 posts since May 2009
Reputation Points: -4 [?]
Q&As Helped to Solve: 14 [?]
Skill Endorsements: 0 [?]
 
0
 

I think it's not effective to site

Member Avatar
chandi786
Newbie Poster
21 posts since Nov 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Just a stupid infact a simple question here.

why do you exactly want to change your letters from upper case to lower case ? is there any SEO benefit or what ?

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article