【问题标题】:How to change the .htaccess file in codeigniter for reading wordpress blog?如何更改 codeigniter 中的 .htaccess 文件以阅读 wordpress 博客?
【发布时间】:2016-04-29 06:49:00
【问题描述】:

我有一个使用 codeigniter 框架设计的网站。对于创建博客页面,我使用 wordpress 通过引用此链接click here

使用这个我创建了一个页面。但对于 cmets 及其所有 以下网址

http://localhost/mywebsite/blog/index.php/2016/04/29/my-new-blog/#respond 

由于 .htacces 限制,它显示 404 错误页面

下面是我尝试过的 .htaccess 代码

RewriteEngine on
RewriteCond $1 !^(index\.php|asset|info\.php)
RewriteRule ^(.*)$ index.php?$1 [L]
RewriteRule ^(blog)$ index.php?$1 [L]

但是还是不行

【问题讨论】:

  • 在这个链接中http://localhost/mywebsite/blog/index.php/2016/04/29/my-new-blog/#respondblog的子目录?我知道它是一个控制器,所以它应该在index.php之后。

标签: wordpress .htaccess codeigniter


【解决方案1】:

如果您单独为您的博客安装了 wordpress。放慢脚步

1) 使用名为博客的 wordpress 仪表板创建一个页面

  By page->new->blog->publish

2)只做首页

 By settings->Front page displays->Posts page or front page->blog

3)只需复制该页面的 URL,您就可以在 codeigniter 框架中的任何位置使用它来打开博客

4)如果您再次遇到 404 问题,您可以使用 .htaccess 或永久链接进行检查

Go to settings-> permalink-> set it as default ->Reload or refresh
Then again now Go to settings-> permalink->postname
Your .htaccess will get update with the permalink.

【讨论】:

  • 我已将 wordpress 文件存储在 wp 文件夹中。现在它的工作,但链接鞋localhost/mywebsite/wp/blog。我不想显示 wp。
  • 你想显示另一个链接而不是这个链接吗?如果是 goto->pages->blog->title 你可以看到永久链接:localhost/mywebsite/blog 你可以在这里更改。
  • 嗨,我选择了plain。但是如果你去其他博客显示wp?
  • 好的去设置->永久链接->自定义结构->你可以定义你的网址,当它从上面解决时让我是第4步?
猜你喜欢
  • 1970-01-01
  • 2011-11-13
  • 1970-01-01
  • 2015-10-05
  • 2014-02-05
  • 1970-01-01
  • 1970-01-01
  • 2011-05-20
  • 1970-01-01
相关资源
最近更新 更多