静态网站 - 转换为动态,需要从不同主机上的数据库导入信息
这似乎很难问,所以我希望有人能帮忙:
我们长期以来一直在一家提供 PHP、Ruby-on-Rails 和 Drupal/Joomla 支持的托管公司运营静态网站。我知道有点有限,但我们获得了相当不错的搜索引擎排名,并且不希望它们下降。我们最近在另一台主机上创建了两个用 Python/Django 编写的站点。
原始站点现在太大,无法静态处理,我们希望在不更改服务器/网络主机的情况下创建一个更动态的站点。我们想要提供“新”动态站点的数据来自提供 Django 站点的同一数据库。
构建新网站的最佳解决方案是什么?创建连接到其他主机上的数据库的 PHP 页面是否更好? Ruby-on-rails 似乎是一个非常快速的开发环境,与 Django 没有太大不同,我们是否能够从现有数据库中将数据提取到 Rails 站点中,并使用与旧静态页面类似的 url?
This seems really complicated to ask about so I hope someone can help:
We have a long time running static website held with a hosting company that provide PHP, Ruby-on-Rails and Drupal/Joomla support. A little limited I know but we got reasonably decent search engine rankings and didn't want them to drop. We have two much more recently created sites on another host written in Python/Django.
The original site is now too big to handle statically and we want to create a more dynamic site in its place without changing servers/webhosts. The data we want to provide the 'new' dynamic site is from the same database providing the Django sites.
What is the best solution to build the new site with? Is it better to create PHP pages that connect to the database on the other host? Ruby-on-rails seems like a very fast development environment not too dissimilar to Django, would we be able to fetch data from the existing databases into a rails site and use similar urls to our old static pages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
PHP、Django 和 RoR 都能够做到这一点,这取决于你喜欢什么并且感觉更舒服。我对 PHP 有偏见,但人们往往更喜欢其他两个。
URL 将会发生变化,其中一些是因为您必须处理一些 UID 才能从数据库中获取数据,除非您可以确保页面名称是唯一的。也许
/news/example
将更改为/news/example-1
或/news/1/example
。但是,如果example
在news
部分中是唯一的,那么您可以执行/news/example
而无需更改 URL。在开始编码之前三思而后行,这会节省您的时间和大量的重新编码。
PHP, Django and RoR are capable of doing this, it's a matter of what do you like and feel more comfortable with. I'm PHP biased, but people tend to like more the others two.
URLs will change, some of them, as you'll have to handle some UIDs to fetch data from the database, unless you can assure pages names to be unique. Maybe
/news/example
will change to/news/example-1
or/news/1/example
. Bur ifexample
is unique inside thenews
section then you could do/news/example
without altering the URL.Think twice before starting coding anything, it'll save you time and a lot of re-coding.
这里更好的解决方案是知道服务器/托管的更改(即 IP 更改)不会对 SEO 产生任何影响或影响很小。阅读此,此 和此。希望他们能让您相信更改主机不会影响您的页面排名等。
我建议您更改为新服务器并在那里构建新站点,而不是浪费时间使用远程数据库。我会使用 PHP 来完成此操作,使用 RoR 也可以实现同样的效果,但我更喜欢 PHP。
The better solution here is knowing that a change in server/hosting (IP change that is) will not have any or little effect on SEO. Read this, this and this. Hopefully they convince you that changing hosts will not effect your page rank etc.
I would advice you to change to a new server and build your new site there instead of messing around with having a remote database. I would use PHP to do this, the same thing can be achieved with RoR, but PHP is my preference.
如果你周围有人了解并熟悉 Python/Django,我会使用该组合进行重建。没有理由不将服务转移到已有数据库的主机上,这将降低复杂性并提高速度。
虽然我个人对 PHP 有偏见,但我认为最好让所有系统在一致的平台上运行。我在个人项目中使用 Python 和 Ruby,但在工作中我坚持使用 PHP 以保持一切一致。
If you have people around who know and are comfortable with Python/Django, I would rebuild using that combination. There is no reason not to move the serving over the host that already has the database, and that will reduce complexity and increase speed.
While I have a personal bias toward PHP, I would argue that it is better to have all you systems running on a consistent platform. I use Python and Ruby on personal projects, but I stick to PHP at work to keep everything consistent.