1

I have a WordPress blog and I made subfolder like this

https://example.com/Tourism

but when I open this URL with lowercase "t" it shows me 404 not found error:

https://example.com/tourism

this subfolder has a lot of posts and when I open "tourism" (with lowercase "t") it shows me 404 not found.

How can I redirect all "tourism" word to "Tourism" with .htaccess?

  • What have you tried? This would seem to be a relatively simple redirect? However, if you are using WordPress then maybe this should be done inside WordPress, not .htaccess? – MrWhite Jan 29 at 16:13
  • 1
    It is far easier to use all lowercase URLs than mixed case URLs. The rules for redirecting to all lowercase are trivial compared to the rules for figuring out the correct case for each URL individually. I worked for TripAdvisor and they had mixed case URLs like that. They are a big pain to support and don't have much if any advantage. – Stephen Ostermiller Jan 29 at 16:16
  • @MrWhite i didn't try any code. how can i do this with wordpress? I'm new in this kind of wordpress. – meysam Zare Jan 29 at 16:18
  • yes i made this subfolder a few month ago and this kind of urls is indexed in google and changing it may cause problems. @StephenOstermiller – meysam Zare Jan 29 at 16:26
2

In .htaccess, to redirect all URLs that start /tourism to /Tourism then you can do something like the following at the top of the .htaccess file in the root, before the WordPress front-controller:

# Redirect "/tourism" to "/Tourism"
RewriteRule ^t(ourism.*) /T$1 [R=302,L]

Change the 302 (temporary) redirect to 301 when you are sure it's working OK.

For a WordPress specific answer (ie. to redirect late and not interfere with "normal" traffic) then you should ask this on our WordPress sister site at https://wordpress.stackexchange.com/

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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