.htaccess url encoding | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

.htaccess url encoding

UNIX for Advanced & Expert Users


Tags
htaccess, url encoding

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-24-2011
LukasB LukasB is offline
Registered User
 
Join Date: Mar 2011
Last Activity: 5 October 2011, 5:04 AM EDT
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
Question .htaccess url encoding

Hi,
I tried hard to find out solution but no success. I have put together this code in .htaccess:


Code:
Rewritecond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?([^\ ]+)query=(.*?)&([^\ ]+)start=(.*?)&([^\ ]+)\ HTTP/
Rewriterule ^index\.php$ http://subdomain.domain.com/%2/%4? [R=301,L]

RewriteRule ^([a-z]+)/([^/]*)$ /index.php?parameter=0&query=$1&anotherpar=1&start=$2&lastpar=-1 [L]

Working perfectly...but! If there is some diacritics in a address (query parameter), it fails. E.G.: If there is href to:

http://subdomain.domain.com/index.php?parameter=0&query=čř&search=1

when someone clicks it, redirection fails. In browsers address bar it shows

http://subdomain.domain.com/%25C5%25A1%25C4%258D%25C5%2599

Does anyone now a solution how to make it working with european diacritics?

(BTW, what does this htaccess do...url from search engine like

http://subdomain.domain.com/index.php?media=0&query=money&search=1


changes to:

http://subdomain.domain.com/money


and it is actually not only rewrite, but it is 301 redirect, too)

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to find the file encoding and updating the file encoding? cnraja Shell Programming and Scripting 7 05-27-2011 06:50 AM
URL encoding Vichu Shell Programming and Scripting 8 08-27-2008 07:16 PM
encoding palmer18 UNIX for Dummies Questions & Answers 3 08-21-2007 09:35 AM
.htaccess? Puc conDoin UNIX for Dummies Questions & Answers 1 05-28-2001 08:58 AM



All times are GMT -4. The time now is 05:34 PM.