0

Dear Programmers,

I want to change accent characters in my smart URL to non-accent characters... For example : www.mysite.com/123/békítő to www.mysite.com/123/bekito.

Is it possible through .htaccess? Here is my current .htaccess

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>

# Google Analytics Integration - Added by cPanel.
<IfModule mod_substitute.c>
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|(<script src='/google_analytics_auto.js'></script>)?</head>|<script src='/google_analytics_auto.js'></script></head>|i"
</IfModule>
# END Google Analytics Integration 

Thanks in advance,

Tibor

3
Contributors
6
Replies
8
Views
4 Years
Discussion Span
Last Post by LastMitch
4

@tibormarias

I want to change accent characters in my smart URL to non-accent characters... For example : www.mysite.com/123/békítő to www.mysite.com/123/bekito.

I think you know most RewriteRule are usually trial & error just to get the right match.

Try this:

RewriteRule ^([a-zA-Z0-9_'-]+)/(.*)$index.php?qa-rewrite=$0{QUERY_STRING} [L]

Let me know how it goes.

0

Thanks for your kind reply, but unfortunately it didn't work. I still get the following URL www.mysite.com/windows-8-%C3%A9s etc.

5

@tibormarias

Thanks for your kind reply, but unfortunately it didn't work. I still get the following URL www.mysite.com/windows-8-%C3%A9s etc.

That's way off. By the way, what language is this békítő?

0

:) Hungarian. Békítő is someone who wants peace. But it was just an example for an accentful word.

0

I don't think you can change accented chars to non accented equivalents via .htaccess. I think it would be relatively trivial for a redirect in php, but that may cause other problems, depending what you want from it.

Showing the pretty url is one thing, getting the data from the rewritten url may be something else. e.g. Depending on your rewrite:

www.example.com/tania/ 

could mean

www.example.com/index.php?id=tania
www.example.com/index.php?id=tània
www.example.com/index.php?id=tânià
www.example.com/index.php?id=tàniâ

etc. So if you need to make use of $_GET['id'] in that page, it could give you problems. Perhaps I've got the wrong end of the stick here. Stripping accents - to me - seems to be a one-way conversion.

5

@tibormarias

:) Hungarian. Békítő is someone who wants peace. But it was just an example for an accentful word.

That's cool. That's a good word to used.

I agree with diafol. I was also playing around with it. diafol show some nice examples of the url.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.