无法在正确的 URL 中打开 Joomla 文章

发布于 2024-07-16 07:20:42 字数 5613 浏览 5 评论 0原文

问题:我的文章有正确的网址:例如,newsite.com/article。 但是,通过单击一篇文章,我会得到一篇空文章。 我可以看到我的侧边栏。

我将 Joomla 安装移动到服务器中的另一个文件夹中。 我想将我的域从 OldSite.com 更改为 NewSite.com。

我也不确定是否需要更改数据库

我最近在 NewSite.com 上的 configuration.php 是从 OldSite.com 移过来的。

<?php
class JConfig {
var $offline = '1';
var $editor = 'jce';
var $list_limit = '20';
var $helpurl = 'http://help.joomla.org';
var $debug = '0';
var $debug_lang = '0';
var $sef = '1';
var $sef_rewrite = '1';
var $sef_suffix = '0';
var $feed_limit = '10';
var $secret = '----------------';
var $gzip = '0';
var $error_reporting = '7';
var $xmlrpc_server = '0';
var $log_path = '/home/masi/public_html/NewSite/logs';        // I added this
var $tmp_path = '/home/masi/public_html/NewSite/tmp';         // I added this
var $live_site = 'http://www.NewSite.com/';                   // I added this
var $offset = '0';
var $caching = '0';
var $cachetime = '15';
var $cache_handler = 'file';
var $memcache_settings = array();
var $ftp_enable = '0';
var $ftp_host = '127.0.0.1';
var $ftp_port = '21';
var $ftp_user = 'admin';
var $ftp_pass = '------------';              // hidden now for security
var $ftp_root = '';
var $dbtype = 'mysql';
var $host = 'localhost';
var $user = 'masi_jml02';                   
var $db = 'masi_jml02';                      
var $dbprefix = '';
var $mailer = 'mail';
var $mailfrom = '[email protected]';          
var $fromname = '';
var $sendmail = '/usr/sbin/sendmail';
var $smtpauth = '1';
var $smtpuser = '';
var $smtppass = '';
var $smtphost = 'localhost';
var $MetaAuthor = '0';
var $MetaTitle = '1';
var $lifetime = '15';
var $session_handler = 'database';
var $password = '--------------';                   // hidden now for security
var $sitename = '--------------';                   // hidden now for security
var $MetaDesc = '';
var $MetaKeys = '';
var $offline_message = 'This site is down for maintenance. Please check back again soon.';
}
?>

我对上面的代码添加了注释,以指示在移动安装文件夹后更改的行。

我的 index.php 位于 public_html/NewSite/templates/Theme/

<?php

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl;?>/templates/system/css/general.css" type="text/css" />

<link rel="stylesheet" href="<?php echo $this->baseurl;?>/templates/<?php echo $this->template ?>/css/customize.css" type="text/css" />


<script type="text/javascript" src="<?php echo $this->baseurl;?>/templates/<?php echo $this->template ?>/js/global.js"></script>
<?php if($this->countModules('left') <= 0 ) : ?>

<?php endif; ?>
<?php $div_wrap = ($this->countModules('left')) ? 'modulewrap' : 'modulewrap_wide'; ?>
<?php $div_right = ($this->countModules('user4')) ? 'right' : 'right_wide'; ?>
<?php $div_left = ($this->countModules('right')) ? 'left' : 'left_wide'; ?>
</head><body>
<div id="outerwrap">

  <div id="header">

    <?php if($this->countModules('user1')) : ?>
    <jdoc:include type="modules" name="user1" style="xhtml" />
    <?php else: ?>
    <h1><a href="<?php echo $mainframe->getCfg('live_site');?>" title="<?php echo $mainframe->getCfg('sitename');?>"><?php echo $mainframe->getCfg('sitename');?></a></h1>
    <?php endif; ?>

  </div>

<!-- 3bar column -->
      <?php if ($this->countModules('top')): ?>
      <div id="top">
      <jdoc:include type="modules" name="top" style="xhtml" />
      </div>
      <?php endif; ?>
<!-- End 3bar column -->
  <div class="clear"></div>
  <div id="wrapper">


  <!-- Start leftcol -->
    <?php if($this->countModules('left')) : ?>
    <div id="leftcol">
      <jdoc:include type="modules" name="left" style="xhtml" />
    </div>
    <!-- END leftcol -->
    <?php endif; ?>

<!-- Right column -->
      <?php if ($this->countModules('user3')): ?>
      <div id="user3">
      <jdoc:include type="modules" name="user3" style="xhtml" />
      </div>
      <?php endif; ?>
<!-- End Right column -->

    <div id="mainbody">
      <div class="inside">
        <jdoc:include type="message" />
        <jdoc:include type="component" />
</div>
      <!-- END INSIDE -->
    </div>
    <!-- END MAINBODY -->


      <div class="clear"></div>
    </div>
    <!--END WRAP-->
  </div>
  <!--END WRAPPER-->
  <div class="clear"></div>
  <div id="bottombar"></div>
</div>
<!--END OUTERWRAP-->

<div class="designer">
<jdoc:include type="modules" name="footer" style="raw" /></div>


</body>
</html>

Problem: My articles have the right urls: for example, newsite.com/article. However, by clicking an article I get an empty article. I can see my sidebar.

I moved my Joomla installation to a different folder in my server.
I want to change my domain from OldSite.com to NewSite.com.

I am not sure whether I need to change the database or not too.

My recent configuration.php at NewSite.com which was moved from OldSite.com.

<?php
class JConfig {
var $offline = '1';
var $editor = 'jce';
var $list_limit = '20';
var $helpurl = 'http://help.joomla.org';
var $debug = '0';
var $debug_lang = '0';
var $sef = '1';
var $sef_rewrite = '1';
var $sef_suffix = '0';
var $feed_limit = '10';
var $secret = '----------------';
var $gzip = '0';
var $error_reporting = '7';
var $xmlrpc_server = '0';
var $log_path = '/home/masi/public_html/NewSite/logs';        // I added this
var $tmp_path = '/home/masi/public_html/NewSite/tmp';         // I added this
var $live_site = 'http://www.NewSite.com/';                   // I added this
var $offset = '0';
var $caching = '0';
var $cachetime = '15';
var $cache_handler = 'file';
var $memcache_settings = array();
var $ftp_enable = '0';
var $ftp_host = '127.0.0.1';
var $ftp_port = '21';
var $ftp_user = 'admin';
var $ftp_pass = '------------';              // hidden now for security
var $ftp_root = '';
var $dbtype = 'mysql';
var $host = 'localhost';
var $user = 'masi_jml02';                   
var $db = 'masi_jml02';                      
var $dbprefix = '';
var $mailer = 'mail';
var $mailfrom = '[email protected]';          
var $fromname = '';
var $sendmail = '/usr/sbin/sendmail';
var $smtpauth = '1';
var $smtpuser = '';
var $smtppass = '';
var $smtphost = 'localhost';
var $MetaAuthor = '0';
var $MetaTitle = '1';
var $lifetime = '15';
var $session_handler = 'database';
var $password = '--------------';                   // hidden now for security
var $sitename = '--------------';                   // hidden now for security
var $MetaDesc = '';
var $MetaKeys = '';
var $offline_message = 'This site is down for maintenance. Please check back again soon.';
}
?>

I put comments to the above code to indicates rows which I changed after I moved the installation folder.

My index.php at public_html/NewSite/templates/Theme/

<?php

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl;?>/templates/system/css/general.css" type="text/css" />

<link rel="stylesheet" href="<?php echo $this->baseurl;?>/templates/<?php echo $this->template ?>/css/customize.css" type="text/css" />


<script type="text/javascript" src="<?php echo $this->baseurl;?>/templates/<?php echo $this->template ?>/js/global.js"></script>
<?php if($this->countModules('left') <= 0 ) : ?>

<?php endif; ?>
<?php $div_wrap = ($this->countModules('left')) ? 'modulewrap' : 'modulewrap_wide'; ?>
<?php $div_right = ($this->countModules('user4')) ? 'right' : 'right_wide'; ?>
<?php $div_left = ($this->countModules('right')) ? 'left' : 'left_wide'; ?>
</head><body>
<div id="outerwrap">

  <div id="header">

    <?php if($this->countModules('user1')) : ?>
    <jdoc:include type="modules" name="user1" style="xhtml" />
    <?php else: ?>
    <h1><a href="<?php echo $mainframe->getCfg('live_site');?>" title="<?php echo $mainframe->getCfg('sitename');?>"><?php echo $mainframe->getCfg('sitename');?></a></h1>
    <?php endif; ?>

  </div>

<!-- 3bar column -->
      <?php if ($this->countModules('top')): ?>
      <div id="top">
      <jdoc:include type="modules" name="top" style="xhtml" />
      </div>
      <?php endif; ?>
<!-- End 3bar column -->
  <div class="clear"></div>
  <div id="wrapper">


  <!-- Start leftcol -->
    <?php if($this->countModules('left')) : ?>
    <div id="leftcol">
      <jdoc:include type="modules" name="left" style="xhtml" />
    </div>
    <!-- END leftcol -->
    <?php endif; ?>

<!-- Right column -->
      <?php if ($this->countModules('user3')): ?>
      <div id="user3">
      <jdoc:include type="modules" name="user3" style="xhtml" />
      </div>
      <?php endif; ?>
<!-- End Right column -->

    <div id="mainbody">
      <div class="inside">
        <jdoc:include type="message" />
        <jdoc:include type="component" />
</div>
      <!-- END INSIDE -->
    </div>
    <!-- END MAINBODY -->


      <div class="clear"></div>
    </div>
    <!--END WRAP-->
  </div>
  <!--END WRAPPER-->
  <div class="clear"></div>
  <div id="bottombar"></div>
</div>
<!--END OUTERWRAP-->

<div class="designer">
<jdoc:include type="modules" name="footer" style="raw" /></div>


</body>
</html>

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

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

发布评论

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

评论(3

南冥有猫 2024-07-23 07:20:42

好的...

  • 您将整个安装移动到一个新目录吗? 子目录?
  • “无法正确打开”是什么意思? 请提供错误信息或链接!
  • 你调整了configuration.php!? 你能把它发布在这里(取出密码)
  • 它绝对可以在数据库中不做任何事情的情况下工作。
  • 您确定configuration.php中的更改已生效吗? 例如文件不可写或者您离线编辑它并忘记上传它...
  • 您是否干预了模板的index.php? 也许 url 是硬编码在某处?
  • 是否还有另一个组件/模块/插件需要重新调整/重新配置?

ok...

  • you moved the whole installation to a new directory? subdirectory?
  • what do you mean by 'not open correctly'? please provide error messages or a link!
  • you adjusted the configuration.php!? can you post it here (take passwords out)
  • it definitely works without doing anything in the database.
  • are you sure the changes in the configuration.php have taken effect. for example file was not writable or you edited it offline and forgot to upload it...
  • did you meddle with the index.php of your template? maybe the url is hard-coded somewhere?
  • is there another component/module/plugin which needs readjustement/reconfiguration?
分开我的手 2024-07-23 07:20:42

我的站点配置为使用 mod_rewrite 但没有可用的 .htaccess 文件。

我禁用了 mod_rewrite,链接现在可以使用。

My site was configured to use mod_rewrite but there was no .htaccess file available.

I disabled the mod_rewrite, and the links now work.

银河中√捞星星 2024-07-23 07:20:42

如果您的新网站位于网络服务器根目录下的子文件夹中,只需检查 .htaccess 文件中的 RewriteBase 指令。 将 RewriteBase / 更新为 RewriteBase /subfolder/
正如我所看到的,您网站的根目录很可能是 public_html 目录,而实际网站位于 NewSite 目录中。 因此,请尝试将 RewriteBase / 替换为 RewriteBase /NewSite/ (尾部斜杠是必需的)。

If youк new website is located in subfolder under web-server's root, just check RewriteBase directive in .htaccess file. Update RewriteBase / to RewriteBase /subfolder/
As I can see it is higly possible that your site's root is public_html directory while actual website is located in NewSite directory. So try to replace RewriteBase / to RewriteBase /NewSite/ (trailing slash is mandatory).

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