Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在drupal中设置基本url_Drupal_Base Url - Fatal编程技术网

如何在drupal中设置基本url

如何在drupal中设置基本url,drupal,base-url,Drupal,Base Url,在这里我可以设置drupal站点的基本url。当前,当我在本地主机中转到该站点时,它会重定向到原始站点。请帮帮我 我尝试在sites/default/settings.php中设置$base_url $base_url = 'http://baseurl.com'; 下面是我设置基本url的部分 /** * Base URL (optional). * * If you are experiencing issues with different site domains, * unc

在这里我可以设置drupal站点的基本url。当前,当我在本地主机中转到该站点时,它会重定向到原始站点。请帮帮我

我尝试在sites/default/settings.php中设置$base_url

$base_url = 'http://baseurl.com';
下面是我设置基本url的部分

/**
 * Base URL (optional).
 *
 * If you are experiencing issues with different site domains,
 * uncomment the Base URL statement below (remove the leading hash sign)
 * and fill in the URL to your Drupal installation.
 *
 * You might also want to force users to use a given domain.
 * See the .htaccess file for more information.
 *
 * Examples:
 *   $base_url = 'http://www.example.com';
 *   $base_url = 'http://www.example.com:8888';
 *   $base_url = 'http://www.example.com/drupal';
 *   $base_url = 'https://www.example.com:8888/drupal';
 *
 * It is not allowed to have a trailing slash; Drupal will add it
 * for you.
 */
# $base_url = 'http://www.example.com';  // NO trailing slash!
$base_url = 'http://localhost/mysite';  // NO trailing slash!
settings.php

$base_url = 'http://baseurl.com';
编辑
你在我发布这篇文章时进行了编辑。你能把
settings.php
文件中的部分粘贴到你要设置的地方吗?您确定在
settings.php
中没有其他
$base\u url
设置吗

通常不需要设置基本url,
您只需清除drupal缓存

在将数据库从远程服务器恢复到本地主机后,我遇到了类似的问题,原来这是由“移动工具”造成的,它在安装时劫持了我的站点重定向。在备份或导出数据库之前禁用它可以解决此问题。刚刚发布,以防有人遇到此问题。

你好,大卫,最初它没有在settings.php中设置。我已将代码粘贴到我的问题中。好的,谢谢。你能再解释一下吗?你怎么知道还没定下来?是什么给你带来麻烦的?我以前从未遇到过这样的问题。我已将内容从服务器下载到本地主机并导出数据库。在settings.php中设置数据库完成此操作后,我尝试在本地主机中访问该站点。但它会重定向到原始站点。因此,我最终在settings中设置了base url变量,ph是可选的。数据库中是否有任何设置。例如,在wordpress中,我们必须更改数据库中的主页和站点url才能访问网站。更具体地说,“清除缓存和重建路由表的PHP文件”部分对我很有用!!!