简体   繁体   中英

htaccess rewrite rule for specific domain

So I have this rule that's working perfectly:

RewriteRule ^images_designs/([^.]+)-d00([^/]+)\.png$ /image_design_watermark.php?design=$2 [L,QSA,NC]

Now I would just add an additional "language" variable related to the domain the htaccess is used on

I have tried this but it's not working:

RewriteCond %{HTTP_HOST} ^(ni-dieu-ni-maitre|blablabla)\.com$ [NC] 
RewriteRule images_designs/([^.]+)-d00([^/]+)\.png$ /image_design_watermark.php?design=$2&language=fr [L,QSA,NC]

RewriteCond %{HTTP_HOST} ^(no-gods-no-masters|ni-dios-ni-amo)\.com$ [NC]
RewriteRule images_designs/([^.]+)-d00([^/]+)\.png$ /image_design_watermark.php?design=$2&language=en [L,QSA,NC]

The %{HTTP_HOST} includes subdomains so you should add the www into that.

RewriteCond %{HTTP_HOST} ^(?:www\.)?(ni-dieu-ni-maitre|blablabla)\.com$ [NC]

and

RewriteCond %{HTTP_HOST} ^(?:www\.)?(no-gods-no-masters|ni-dios-ni-amo)\.com$ [NC]

or you could make it looser and take off the starting anchor, ^ I'd go this route though.

Reference: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM