.htaccess Wildcard Subdomains

后端 未结 3 1099
终归单人心
终归单人心 2020-12-09 14:04

I\'m trying to implement a solution using .htaccess and wildcard subdomains so that

http://subdomain.example.com is mapped to http://example.com/index.php/accounts/s

3条回答
  •  我在风中等你
    2020-12-09 14:54

    Try changing your RewriteRule to

    RewriteRule ^/(.*)$ /index.php/accounts/%1/$1 [PT]
    

    That will rewrite the URL to one that includes the subdomain and the original request URI.

    EDIT: maybe it needs to be

    RewriteRule ^(.*)$ /index.php/accounts/%1/$1 [PT]
    

    as mentioned in the comments.

提交回复
热议问题