0

I have to redirect URL with Upper Case parameter to URL with Lower Case parameter.

Since I don't have access to httpd.config file, help me with some pieces of lines to do it in .htaccess file.

For example:

www.domain.com/Whatsapp-For-Business-A-Beginners-Guide

to

www.domain.com/whatsapp-for-business-a-beginners-guide

Thanks in advance.

Dinesh
  • 11
  • 6
  • Please have a look into this question, I guess you will find your answer https://stackoverflow.com/questions/22206786/using-apache-htaccess-file-to-change-url-to-lowercase – pwain Oct 30 '17 at 06:46
  • Possible duplicate of [Convert to lowercase in a mod\_rewrite rule](https://stackoverflow.com/questions/2923658/convert-to-lowercase-in-a-mod-rewrite-rule) – Vipin CP Oct 30 '17 at 06:47
  • I don't have access to httpd.config file. I need to make it happen in htaccess file itself. – Dinesh Oct 30 '17 at 07:09

1 Answers1

0

If you have the opportunity to use php:

You can do that. in the .htaccess (before actual RewriteRule):

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule [A-Z] /linkChange.php?l=%{REQUEST_URI} [L]

and in linkChange.php :

<?php 
    $link = $_GET['l'];
    $newlink = strtr($link," ABCDEFGHIJKLMNOPQRSTUVWXYZ","-abcdefghijklmnopqrstuvwxyz");
    header("Location: http://www.exemple.com". $newlink,TRUE,301); exit;
?>
Croises
  • 18,570
  • 4
  • 30
  • 47