Create friendly url with .htaccess

1

I am creating a personal website, in which I will have only one index page with different languages. I have 3 links that call me by parameter to the index by passing the language:

<li class="lang"><a href="index.php?lang=en">EN</a></li>
<li class="lang"><a href="index.php?lang=es">ES</a></li>
<li class="lang"><a href="index.php?lang=ca">CA</a></li>

And I am creating a .htaccess file that according to the language that comes by parameter, add a / is / in or / ca to the end of the web name. Right now what I have in the .htaccess file is this:

RewriteEngine On

RewriteRule ^(.)?$ index.php?lang=en [L,QSA]
RewriteRule ^(es|en)?$ index.php?lang=$1 [L,QSA]

If I enter the name / is or / in o / ca redirects me well and shows me the web in that language, but if I click on the links on the page I see the

index.php?lang=es

I do not know if it's because I'm working on localhost, or that I have to change something in the rules, but even though I'm looking for it I have not managed to make it work.

Thanks

    
asked by yhazius 16.09.2017 в 16:25
source

1 answer

0

As I indicated in the comments, thanks to @aldanux I solved my problem by changing the urls of the links to the languages leaving only the value of the parameter of the url, so that:

<li class="lang"><a href="en">EN</a></li>
<li class="lang"><a href="es">ES</a></li>
<li class="lang"><a href="ca">CA</a></li>
    
answered by 16.09.2017 в 17:13