1

I'm a bit stuck, so thank you for any help!

In short I'm trying to convert either of the two examples (I have mod_rewrite from the first to the second already). I only want this to apply to the https://www.example.com/wiki/ folder.

convert either:

https://www.example.com/wiki/index.php?title=Links_Frequently_Requested

https://www.example.com/wiki/Links_Frequently_Requested/

into:

https://www.example.com/wiki/links_frequently_requested/

The rewrite I already have is as follows, but it will not drop case..

RewriteCond %{REQUEST_URI}  wiki
RewriteCond %{REQUEST_URI}  index.php
RewriteCond %{QUERY_STRING} ^title=(.*)
RewriteRule ^(.*)$ https://www.example.com/wiki/%1/? [R=302,L]
  • Do you have access to the server config? Where is your .htaccess file located? Do you have any other directives? Any other .htaccess files? – MrWhite Aug 7 at 0:15
  • Hi yes I have access to the full server (Cpanel Based). Apache 2.4, Php 7.1. I tried to add the following to the httpd.conf file: RewriteEngine On RewriteMap lowercase int:tolower and then the following to the root of my site (not the right redirect... need to figure that out... but it does redirect and shows the lowercase function is not triggering... Case remains Upper Case). Root .htaccess: #RewriteCond %{REQUEST_URI} wiki3 #RewriteCond %{REQUEST_URI} index.php #RewriteCond %{QUERY_STRING} ^[^A-Z]*[A-Z].* #RewriteRule ^ ${lc:%{QUERY_STRING}} [R=302,L] – Steve Aug 7 at 4:27
  • Please edit your question to add your code snippets. The unformatted code in comments can also omit characters that should be present. – MrWhite Aug 7 at 17:05
1

RewriteCond is by default evaluated with the [AND] operator, which means https://www.example.com/wiki/Links_Frequently_Requested/ is never true in your original example. Consider having two different rules to cover both alternatives, or use the [OR]-operator.

Also, .htaccess works on a directory-level, so you should consider creating a separate htaccess-file for your wiki-directory. Of course, the rules are inherited, so any sub-directories would need a copy of your root htaccess in order to not convert from upper- to lowercase.

Other than that, the question has been answered elsewhere on StackExchange: https://serverfault.com/questions/177647/convert-and-redirect-url-in-uppercase-to-lowercase-using-htaccess

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.