How to set the base url in drupal

帅比萌擦擦* 提交于 2019-12-01 03:24:42

问题


Where I can set the base url for drupal site. Currently when I go to the site in my localhost, it redirects to the original site. Please help me.

I have tried setting the $base_url in the sites/default/settings.php

Here is the portion where I set the base 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!

回答1:


Usually you don't need to set base_url, you simply have to clear drupal cache.




回答2:


settings.php

$base_url = 'http://baseurl.com';

EDIT You edited as I posted this. Can you paste the portion of your settings.php file where you're setting it? Are you sure there's no other $base_url set elsewhere in settings.php?




回答3:


I faced a similar problem like this after restoring database from my remote server to my localhost, turns out it was being caused by "mobile tools" which hijacks the redirection of my site whenever it is installed. disabling it before backing up or exporting the database solved the problem. Just posting in case someone ran into this hiccup.



来源:https://stackoverflow.com/questions/5879190/how-to-set-the-base-url-in-drupal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!