× Here you can get community support related to ReDJ.

Redirect rule to replace characters?

  • joomlamus
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago #2557 by joomlamus
Redirect rule to replace characters? was created by joomlamus
Hi,
is it possible to create a redirect rule to replace just some characters of a url? I would like to have a rule which replaces the string "ä" with the character "ä" in any url. Is this possible with ReDJ?

Regards,
Paula

Please Log in or Create an account to join the conversation.

More
9 years 11 months ago #2559 by admin
Replied by admin on topic Redirect rule to replace characters?
Hi,
before to answer your question I would like to draw your attention to an aspect of URL requests. If you type an URL like this in your browser:

www.example.com/säsä

The request made to the server is actually:

www.example.com/s%C3%A4s%C3%A4

So the server will never receive the ä char. If you create a redirect from the %C3%A4 to the ä you will get %C3%A4 again.

Having said that,it could be possible to create a rule to replace a single char using existing (or a custom) macro.

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

  • joomlamus
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago - 9 years 11 months ago #2562 by joomlamus
Replied by joomlamus on topic Redirect rule to replace characters?
Hi Luigi,

I just realized that the forums editor "corrected" my post: i want to replace the html-entitys with the umlauts (or the utf-8-equivalents). So its & o u m l ; (without the spaces) which should go to "ö" or "%C3%B6". I was not aware of the fact that umlauts are automatically put to utf-8, so thank you for this!
I now tried to solve this with a redirect rule in htaccess, but neither
RewriteRule ^(.*)(%26ouml%3b)(.*) /$1%C3%B6$3 [R=301] nor
RewriteRule ^(.*)( & o u m l ; )(.*) /$1%C3%B6$3 [R=301]
will work. Hmm, I will work further on this. Maybe I will have to look how to build a custom macro in ReDJ.

Paula
Last edit: 9 years 11 months ago by joomlamus.

Please Log in or Create an account to join the conversation.

  • joomlamus
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago #2563 by joomlamus
Replied by joomlamus on topic Redirect rule to replace characters?
Ok, if anyone has the same problem, this works for me:

RewriteRule ^(.*)( & o u m l ; )(.*) /$1\%C3\%B6$3 [NE,R=301,L]
(without the spaces between the brackets)

This for the "ö", added by equivalent RewriteRules for the other umlauts or special characters.

Please Log in or Create an account to join the conversation.

More
9 years 11 months ago #2564 by admin
Replied by admin on topic Redirect rule to replace characters?
Thanks for sharing. :)

Luigi

Please Log in or Create an account to join the conversation.

Time to create page: 0.142 seconds