【问题标题】:Wordpress inside Code Igniter is not loading to right pagesCode Igniter 中的 Wordpress 未加载到正确的页面
【发布时间】:2013-09-14 16:18:36
【问题描述】:

我有一个 Code Igniter 网址:www.example.com,它运行良好。

现在我在根文档中创建了一个名为 pages 的文件夹,并在这个“pages”文件夹中安装了 wordpress。

我期待当我访问 www.example.com/pages 时,我会得到 wordpress 页面,但是当我打开 www.example.com/pages 时,它会自动重定向到 http://www.example.com/login

因此我无法查看我的 wordpress 页面。

我尝试过的:我将 .htaccess 文件更改为重定向,但它不起作用。我还检查了 wordpress 的数据库,但没有找到任何东西。默认站点(Code Igniter)与 Wordpress 有不同的数据库。

我位于 www.example.com 的 .htaccess 文件是这样的:

<IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On

# If your website begins from a folder e.g localhost/my_project then
# you have to change it to: RewriteBase /my_project/
# If your site begins from the root e.g. example.local/ then
# let it as it is
RewriteBase /

# Protect application and system files from being viewed when the index.php is missing
RewriteCond $1 ^(application|system|private|logs)

# Rewrite to index.php/access_denied/URL
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]

# Allow these directories and files to be displayed directly:
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|public|assets|css|js|images|pma  \.php|uploads|assets)

# No rewriting
RewriteRule ^(.*)$ - [PT,L]

# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
</IfModule>

【问题讨论】:

  • Codeigniter 不会在默认情况下寻找名为 pages 的控制器吗?这是您需要在路线中更新的内容吗? Docs
  • Check this 以及这些答案(onetwo)。
  • @jbird:我使用过 WordPress,但对 CI 来说绝对是新手。
  • @SheikhHeera:不,这是行不通的。在尝试了这些页面中的内容后,我仍然无法打开页面。
  • @jbird:我添加了以下几行 >>> $route['pages/(:any)'] = 'blog/$1'; $route['pages'] = '博客';

标签: wordpress codeigniter


【解决方案1】:

朋友们,

我自己解决了这个问题。我在 .htaccess 文件中做了这样的重定向:

RewriteBase /page/

另外,以前我使用单独的数据库用于 CI 和 Wordpress。我合并了数据库。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多