Forum archive
Redirect and RewriteMap failing in .htaccess
Specs:
Apache/2.2.16 (Debian) Server
Wordpress 4.x
---------------
I'm trying to convert this 'vanity URL' that our graphic design guy created for print ads:
http://tbrhsc.net/PaediatricORtour/
to this:
http://tbrhsc.net/paediatricortour/
I figured a Redirect would work for this. I'm using Wordpress, and this is what I originally added to my .htaccess file in the wordpress root folder:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Redirect ^PaediatricORtour/?$ /paediatricortour/
....
</ifModule>
-----------------------
However, this didn't do anything but send me to my 404 page.
------------------------
So, looking online to find something to convert to lower case (which is ultimately what I'm trying to do), I found this suggestion:
Redirect a URI to an all-lowercase version of itself
RewriteMap lc int:tolower
RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]link: http://httpd.apache.org/docs/2.2/rewrite/rewritemap.html#int
I'm getting a 500 internal error when trying to add those two lines to my .htaccess file just below the line: RewriteEngine On.
I've tried variations, like this one:
RewriteMap tolower int:tolower
RewriteRule ^([^/]+)/?$ /${tolower:$1}or this one:
RewriteMap tolower int:tolower
RewriteRule ^([^/]+)/?$ /${tolower:$1} [R=301,L]link reference: http://stackoverflow.com/questions/2923658/convert-to-lowercase-in-a-mod...
... I've also added this line above those:
RewriteBase /
But all of them give me a 500 Internal Server Error.
... I've even tried adding those lines and then rebooting.
------------------------------------------------------------------------
So, can someone tell me what's going on?... is there something obvious I'm missing?... maybe Apache is somehow modified by Turnkey to not use that RewriteMap function... I'm at a loss when nothing I try seems to work.
Thanks for any assistance.
FWIW if you have some time and want to have a play with it you could download the appliance (as a VM or an ISO) and install locally on virtualbox. Then add an entry to your hosts file (something that won't ever use) and set the same domain on the VM. Then fiddle and test with no real world consequence! :)