whispers
whispers

Reputation: 962

HTACCESS 302 redirects from capitalized path

I tried to search but only came up with solution that use a ReWriteMap (which I have never used before.. and not sure if its even required for this?

Using this .htaccess online tester, it shows my attempts would work, nit in practice....they dont.

http://htaccess.mwl.be/

URL: http://www.somedomain.com/ABCD/somthing-else/another-directory

should redirect to: http://www.somedomain.com/abcd/somthing-else/another-directory

basically any and all: http://www.somedomain.com/ABCD

should redirect to: http://www.somedomain.com/abcd

everything (if anything at all) after the ABCD/ should be kept and passed on to the new abcd/ url?

I tried this:

RewriteRule ^AAEM18 /aaem18 [NC,R=301,L]

Which the tester site says:
The new url is http://www.somedomain.com/abcd/somthing-else/another-directory

But when I uploaded the new .htaccess file..

it just going to:

http://www.somedomain.com/abcd

Upvotes: 0

Views: 35

Answers (1)

Croises
Croises

Reputation: 18671

If it's only for one directory (ABCD), you can use:

RewriteCond %{REQUEST_URI} ^/abcd(/.+)?$ [NC]
RewriteRule !^abcd  abcd%1  [R=301,L]

Or with [R,L] for 302, like in your title.

You can use for multiple directories by multiplying RewriteCond/RewriteRule. But it's not the solution if you want to do it for all your directories.

It works with: /ABCD/... or /AbCd/, /ABcd/ etc. -> /abcd/...

Upvotes: 1

Related Questions