【发布时间】:2018-04-23 13:35:53
【问题描述】:
我的网站有一些页面:
http://example.com/myuglyurl.php?id=11
http://example.com/myuglyurl.php?id=12
http://example.com/myuglyurl.php?id=13
而且,对于某些页面,我希望我的用户在他们的浏览器中看到他们在子域中,例如:
http://example.com/myuglyurl.php?id=11
http://mynewsubdomain.example.com/myuglyurl.php?id=12
http://example.com/myuglyurl.php?id=13
子域存在,当用户直接尝试访问子域时,我会将它们重定向到特定页面,没问题。但是网址掩码我做不到。
我尝试过各种 .htaccess 技巧,但由于我对 .htaccess 完全陌生,我无法做到。
我试过了:
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteCond %{QUERY_STRING} (^|&)id=12($|&)
RewriteRule ^myuglyurl\.php$ http://mynewsubdomain.example.com/myuglyurl.php?%{QUERY_STRING}
但我得到一个空白页面,并显示消息:找不到文件。
【问题讨论】:
标签: .htaccess subdomain url-masking