I have a problem with subdomains I used to translate my website. With the 4 first lines of code, I've no problem, the sub var is passed fine (http://en.mywebsite.com/ gives http://mywebsite.com?sub=en). The 5th line is used to manage ads, once I click on the link like http://en.mywebsite.com/blue-chair-Vha6J.html the page isn't loaded and I stay on the home page. It should gives me something like http://mywebsite.com?sub=en&menu=ad&ad=Vha6J. Instead of this, it gives me http://mywebsite.com?sub=en.
RewriteBase /
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_HOST} ^([a-z]+)\.mywebsite\.com$ [NC]
RewriteRule ^(.*) ?sub=%1 [NC,L]
RewriteRule ^([-a-z0-9]+)-([A-Za-z0-9]+)\.html$ ?sub=%1&menu=ad&ad=$2 [L]
[EDIT 1]
Ok, here is a bigger htaccess extract, included the modifications I made with the first answer, and I still have problems :
RewriteBase /
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} !&menu=.*
RewriteCond %{HTTP_HOST} ^([a-z]+)\.mywebsite\.com$ [NC]
RewriteRule ?sub=%1 [NC,L]
RewriteCond %{HTTP_HOST} ^([a-z]+)\.mywebsite\.com$ [NC]
RewriteRule ^cart$ ?sub=%1&menu=cart [L]
RewriteRule ^login$ ?sub=%1&menu=login [L]
########### AD
RewriteRule ^([-a-z0-9]+)-([A-Za-z0-9]+)\.html$ ?sub=%1&menu=ad&ad=$2 [L]
RewriteRule ^([-a-z0-9]+)-([A-Za-z0-9]+)\.html\/([A-Za-z0-9]+)$ ?sub=%1&menu=ad&ad=$2&secret=$3 [L]
########### ADS
RewriteRule ^all\/([-A-Za-z0-9]+)$ ?sub=%1&menu=ads§ion_name=$1 [L]
RewriteRule ^all\/([-A-Za-z0-9]+)\/([-A-Za-z0-9]+)$ ?sub=%1&menu=ads§ion_name=$1&category_name=$2 [L]
RewriteRule ^all\/([-A-Za-z0-9]+)\/([-A-Za-z0-9]+)\/([-A-Za-z0-9]+)$ ?sub=%1&menu=ads§ion_name=$1&category_name=$2&subCategory_name=$3 [L]
########### SHOPS
RewriteRule ^shops$ ?sub=%1&menu=shops [L]
########### SHOP
RewriteRule ^([-a-z0-9]+)$ ?sub=%1&menu=shop&shop=$1 [L]
RewriteRule ^([-a-z0-9]+)\/([-a-z0-9]+)$ ?sub=%1&menu=shop&shop=$1&category_name=$2 [L]
When I'm on the home page https://en.mywebsite.com/, the sub var "en" is passed fine. If I go on https://en.mywebsite.com/login for instance, the page is loaded, but the sub var "en" isn't passed.
Any idea ? Thanks.