【发布时间】:2015-07-02 14:18:15
【问题描述】:
我有一个站点example.com,其文件位于/path/to/example/ 它有子域subdomain.example.com,其文件位于/path/to/example/subdomain/ 我如何使用.htaccess 提供这些文件而无需重定向?
我试过了
RewriteCond %{HTTP_HOST} ^subdomain.example.com
RewriteRule ^(.*)$ http://example.com/subdomain/$1 [L]
但这会将用户重定向到新页面。
我也试过
RewriteCond %{HTTP_HOST} ^subdomain.example.com
RewriteRule ^(.*)$ /subdomain/$1 [L]
但这会导致服务器错误。
【问题讨论】:
标签: regex apache .htaccess mod-rewrite subdomain