多个域到一个动态站点

发布于 2024-12-18 02:07:34 字数 659 浏览 1 评论 0原文

我正在为一家拥有多个用户/销售人员的公司建立一个网站,每个用户都需要自己的网站。我想要完成的是建立一个可以动态提取每个用户信息的网站。因此,我将建立一个网站并动态提取每个用户的信息。例如:

www.company.com/Mike
www.company.com/Steve
www.company.com/Jason

每个 url 都会使用会话、cookie 和 url 变量提取该特定用户的信息和内容。这将使每个 url 看起来像是不同的站点,尽管它是具有动态数据的同一站点。我知道如何实现这一点,但我真正想要实现的是为每个用户提供自己的域。

我的问题是:如何允许每个用户设置一个唯一的域,然后将该域指向动态提取动态数据的 url:

Mike.com --> www.company.com/Mike 
Steve.com --> www.company.com/Steve
Jason.com --> www.company.com/Jason  

我想完成此任务并确保他们的网站像独立网站一样对 SEO 友好地点。我知道我可以转发网址,但我想要一些更像实际网站并且 SEO 友好的东西。

我正在用 php、mysql 和 javascript 构建它。我正在设置的 LAMP 服务器上运行该网站。感谢您的帮助。

I am building a website for a company who has multiple users/sale people and each user needs their own website. What I want to accomplish is building one site that pulls in each users information dynamically. So i will build one site and pull in each users info dynamically. For example:

www.company.com/Mike
www.company.com/Steve
www.company.com/Jason

Each url would then pull in that particular user's information and content using sessions, cookies and url variables. This would then make each url look like a different site although it is the same site with dynamic data. I know how to accomplish this but what i would really like to accomplish is giving each user their own domain.

My question is: How do I allow each user to set up a unique domain and then point that domain to the url that dynamically pulls in the dynamic data:

Mike.com --> www.company.com/Mike 
Steve.com --> www.company.com/Steve
Jason.com --> www.company.com/Jason  

I want to accomplish this and make sure that their site is SEO friendly like a stand alone site. I know that i could just forward the url but i would like something that acts more like an actual site and is SEO friendly.

I am building this in php, mysql and javascript. I am running the site on LAMP server set up. Thank you for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初心 2024-12-25 02:07:34

如果您使用的是apache,则可以使用mod_rewrite来进行重写。尝试将其添加到您的 .htaccess 文件中:

# Match the host
RewriteCond %{HTTP_HOST} ^([^\.]+)\.com$ [NC]

# proxy the entire request to the /host/ and path
RewriteRule ^(.*)$ http://www.company.com/%1/$1  [L,P]

这将使其请求 http://Mike.com/page.html< /a> 将提供 http://www.company.com/Mike/page.html

If you are using apache, you can use mod_rewrite to do the rewriting. Try adding this to your .htaccess file:

# Match the host
RewriteCond %{HTTP_HOST} ^([^\.]+)\.com$ [NC]

# proxy the entire request to the /host/ and path
RewriteRule ^(.*)$ http://www.company.com/%1/$1  [L,P]

This will make it so requesting http://Mike.com/page.html will serve http://www.company.com/Mike/page.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文