在共存codeigniter和Word preSS安装htaccess的帮助 [英] htaccess help in coexisting Codeigniter and Wordpress install
问题描述
在这里我的目的是有同一域下的博客codeigniter应用程序。在管理这两个应该是分开的。
My intention here is to have a codeigniter app with a blog under the same domain. The admin for both should be separate.
的目录结构是这样的:
httpdocs/.htaccess
httpdocs/application/ <== CI installation
httpdocs/blog/ <== WP installation
httpdocs/blog/.htaccess
网址会是这样的:
URLs would be like this:
mysite.com <== CI
mysite.com/tools <== CI
mysite.com/forum <== CI
mysite.com/blog <== WP
我跟着本教程设置和它的工作很好。
I followed this tutorial to set up and it worked nicely.
我的两个codeigniter应用程序和WP的的博客首页的显示,正是因为他们应该用正确的URL,样式等。
Both my codeigniter app and WP blog home page show exactly as they should, with correct URLs, styles etc.
我还可以访问的的 mysite.com/blog/wp-admin 的通常为WP后端的东西。
I can also access mysite.com/blog/wp-admin normally for WP back end stuff.
我的问题是,当我试图访问一个实际的博客文章,例如:
My issue is when I try to access an actual blog post, for example:
mysite.com/blog/fiction/what-is-going-on/
当我这样做,我得到的的 codeigniter的404错误页面的
When I do this, I get Codeigniter's 404 error page.
我的根目录的.htaccess(httpdocs资料/的.htaccess)是这样的:
My root .htaccess (httpdocs/.htaccess) is this:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt|blog|assets)
RewriteRule ^(.*)$ index.php/$1 [L]
我的博客的.htaccess(httpdocs资料/博客/的.htaccess)是这样的:
My blog .htaccess (httpdocs/blog/.htaccess) is this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
知不知道我做错了吗?将发布更多的信息,如果要求。先谢谢了。
Any idea what I'm doing wrong? Will post more info if requested. Thanks in advance.
推荐答案
确定的解决方案是使用
CI的.htaccess
CI .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
和
WP的.htaccess
WP .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
这是没有的伎俩。现在,所有页面显示没有问题。
That did the trick. Now all pages show without a problem.
这篇关于在共存codeigniter和Word preSS安装htaccess的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!