WordPress and .htaccess

Question!

I have a website powered by WordPress MU. The front page of the site is translated in several languages. How do I rewrite the following URLs?

http://www.example.com/?lang=en
http://www.example.com/?lang=fr

to:

http://www.example.com/en/
http://www.example.com/fr/

This is my current .htaccess,

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# Uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
# END WordPress


Answers
I have not tested so I am not 100 % sure if it works but that should give you some ideas.

I advice you to take a look at the documentation of mod-rewrite.

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

#languages
RewriteRule ^/(en|fr)/(.*)$ /$2?lang=$1

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
# END WordPress
By : RageZ


This will redirect and preserve the original query string:

RewriteCond %{QUERY_STRING} (.+)
RewriteRule ^([a-z]{2}) /?lang=$1&%1 [L]

RewriteRule ^([a-z]{2}) /?lang=$1 [L]


Sign up using Google



This video can help you solving your question :)
By: admin