Index.php?lang=en => www.domain.com/EN/index.php

New to mod_rewrite? This is a good place to start.

Index.php?lang=en => www.domain.com/EN/index.php

Postby Psykomaniac » Wed Sep 10, 2003 11:04 am

Hi everybody!

How can I do this? :o
How do I change the values which come with the query string to appear as directories before the actual script name?

Example:
www.domain.com/index.php?lang=en

should become:
www.domain.com/en/index.php

thanks in advance

Thomas
Psykomaniac
 

Postby pippo » Thu Sep 11, 2003 12:05 pm

Hi,

/.htaccess
Code: Select all
RewriteEngine On

RewriteCond %{QUERY_STRING} ^lang=(en|it)$ [NC]
RewriteRule ^index\.php$ /%1/index.php? [R,L]


so typing
www.example.com/index.php?lang=en
you will be externally redirected (30x) to
www.example.com/en/index.php

same applies for ``it'' ( I added it just to show how to handle multiple languages ).


THanks,
:) Andrea
pippo
 
Posts: 6
Joined: Sat Sep 06, 2003 11:27 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 31 guests

cron