0

I ran into this problem when I tried to redirect all contents from one site to another. My http server is apache, and Im using mod_rewrite to do the job. So I added these codes to httpd.conf:

RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^/(.*) http://www.example2.com/$1 [R=301,L]

Everthing seems to be good after Ive done that, however when I visit a urlencoded url such as http://www.example.com/?word=%E5%A4%A9 , apache redirects me to http://www.example2.com/?word=%e5%a4%a9 , as you see, all the urlencoded chars are trasnfered to lowercase which makes me impossible to infrom search engine about my domain change because search engine asks for a exact match of new and old URI(case sensitive).

BTW, when I use urlencode() function in PHP, the results it returned is automatically uppercased, so the standard URL should be something like this %E5%A4%A9.

I googled a lot and got nothing so I had to come here to ask for help, any help will be appreciated, thanks in advance.

  • Take a look at this answer: http://stackoverflow.com/questions/1353807/mod-rewrite-change-url-case – arkascha Jun 06 '13 at 08:53
  • hi,arkascha, Ive seen posts like that early today, and I tried what the posts suggested, but no luck. It will change the case of all the chars in URI except for urlencoded string... – user2458019 Jun 06 '13 at 14:29

1 Answers1

0

Not sure if this works, but try

RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^/(.*) http://www.example2.com/$1?%{QUERY_STRING} [R=301,L]

or

RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^/(.*) http://www.example2.com/$1 [R=301,L,NE]
Gerben
  • 16,747
  • 6
  • 37
  • 56