I need to rewrite url with rule like below
RewriteRule ^files/([a-z0-9-\.]+)$ files/domain.com/$1
domain.com is current host name. It is dynamic (don't ask why plz). So I can not do like this. Anyway, how I can get current host name and put it like this:
RewriteRule ^files/([a-z0-9-\.]+)$ files/{{ current host name with out www. }}/$1
%{HTTP_HOST} will give you the requested host name.
I can't test right now whether it can be used in a RewriteRule, but I think it can.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With