I have the problem, that I when I enter this into my browser:
http://localhost/myString
I can get myString by writing $_GET['id'].
This works thanks to my following .htaccess file:
RewriteEngine on
RewriteRule ^/?([0-9a-zA-Z]+)$ /myFile.php?id=$1
FallbackResource /index.php
Now I want to add the possibility that users can change the default language. I want this to be possible by entering:
http://localhost/en/myString
myString should be accessible through $_GET['id'] and my language code with $_GET['lang'].
I am completely new to writing .htaccess configs so this is what I tried but didn't work:
RewriteEngine on
RewriteRule ^/?([0-9a-zA-Z]+)$ /chat.php?id=$1
RewriteRule ^/?([a-z]+)$/([0-9a-zA-Z]+)$ /chat.php?id=$2&lang=$1
FallbackResource /index.php
$signifies the end of the string to be matched. A basic example might be:RewriteRule ^([a-z]+)/([0-9a-zA-Z]+)$RewriteRule ^(?:([a-z]{2})/)?([0-9a-zA-Z]+)$. Here's an explanation.