I am trying to rewrite this url:
www.answerme.be/index.php?language=nl
to
www.answerme.be/nl
I've already done some research and I am using the tool from generateit.net .
The expression that I am using is the following:
RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?language=$1 [L]
This should work? I am getting a 500 internal server
error.
You're getting 500 due to infinite looping. Fix it by using better regex for 2 character language in URI:
RewriteEngine On
RewriteRule ^([a-z]{2})/?$ /index.php?language=$1 [L,QSA,NC]
If your languages are limited, you can specify them to escape this error
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(nl|en|fr)$ index.php?language=$1 [L]
To be able to use lang param also on uppercase, use this:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([a-zA-Z]{2})$ index.php?language=$1 [L]
It works perfect for me
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.