logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Help with Rewrite Cond and Rule at .htaccess file.
Author
karea12



Joined: 04 Apr 2017
Posts: 1
Location: brazil

PostPosted: Tue 04 Apr '17 22:55    Post subject: Help with Rewrite Cond and Rule at .htaccess file. Reply with quote

Hello friends!

Short question here, I'm having a problem with .htaccess redirect function.


====

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,NC]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\index.html [NC]
RewriteRule ^ %1 [R,NC]


## ## Internal Redirect
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html

====



It works well, cutting the .html and the index.html from the url in the browser, but when a special character like a acute sign à or another ç, ã, it redirects to the long %25C3%25A7 and %25C3%25A3 code symbol character:

The folder structure/file is:
/public_ftp/reidadedetizacaorj/orçamentobão.html

ACTUAL BEHAVIOR:
http://reidadedetizacaorj.com/or%C3%A7amentob%C3%A3o

EXPECTED BEHAVIOR:
http://reidadedetizacaorj.com/orçamentobão

Because of this, host gator shows a 404 page because obviously because or%25C3%25A7amentob%25C3%25A3o is not a file in the server.

Can you guys help me with the needed modifications on the .htaccess file
? Question Question Question Question Question Question Question Question Question Exclamation
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Wed 28 Jun '17 18:15    Post subject: Reply with quote

Matter of fact is that the browser sends the request already with the %SOMETHING. You just don't see it in the address bar. Same thing happens with puny code domain names like münchen.de [1]

However there is the NE parameter for mod rewrite [2]

Try that.

[1] http://kb.mozillazine.org/Network.IDN_show_punycode
[2] http://httpd.apache.org/docs/current/rewrite/flags.html#flag_ne
Back to top


Reply to topic   Topic: Help with Rewrite Cond and Rule at .htaccess file. View previous topic :: View next topic
Post new topic   Forum Index -> Apache