.htaccess subdomain url rewrite

后端 未结 2 1300
攒了一身酷
攒了一身酷 2020-12-22 07:26

I would like to rewrite an url, but I always do not get any adequate results.

I would like the url http://something.domain.com/index.php?arguments... to actually v

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-22 07:44

    You can use this code in your DOCUMENT_ROOT/.htaccess file of something domain:

    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^([^.]+)\.(domain\.com)$ [NC]
    RewriteRule ^(index\.php)$ http://%2/$1?username=%1 [L,QSA,NC,R]
    

提交回复
热议问题