需要 mod_rewrite
可以说我有一个域 example.com 并且我打开了通配符 dns。在 example.com 上,用户可以使用用户名和密码进行注册。注册完成后,username.example.com 开始重定向到 example.com/script/script.php?user=username。地址栏仍会显示 username.example.com
.htaccess 文件的内容是什么来实现此目的?
我对 mod_rewrite 的专业知识为零。请指教。谢谢和问候。
lets says I have a domain example.com and I have wildcards dns switched on. on example.com a user can signup with username and password. once registration is done, username.example.com starts redirecting to example.com/script/script.php?user=username. address bar would still show username.example.com
what would be the contents of the .htaccess file to accomplish this?
I have zero expertise with mod_rewrite. please advise. thanks and regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为此,您需要的不仅仅是 mod_rewrite - 您还需要阅读 apache 虚拟主机。
You need more than mod_rewrite for this - you also need to read-up on apache virtual hosts.
假设您的主机配置为提供来自同一
DocumentRoot
的所有主机名,那么您需要类似这样的内容:如果您在共享主机上并且无法指定调试日志文件,在您有权访问的测试服务器上进行您自己的测试。
Assuming your host is configured to serve up all hostnames from the same
DocumentRoot
, then you'd want something a lot like this:If you're on shared hosting and can't specify a debug-log file, do your own tests on a test server you have access to.