Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Codeigniter-重写到.htaccess中包含wordpress安装的子目录_Wordpress_.htaccess_Codeigniter_Mod Rewrite - Fatal编程技术网

Codeigniter-重写到.htaccess中包含wordpress安装的子目录

Codeigniter-重写到.htaccess中包含wordpress安装的子目录,wordpress,.htaccess,codeigniter,mod-rewrite,Wordpress,.htaccess,Codeigniter,Mod Rewrite,我在localhost/site有CodeIgniter,在localhost/site/blog的子目录中有Wordpress 每个都可以正常工作-除了我希望站点目录中的某些URL指向Wordpress子目录 我将它们转发到站点文件夹的.htaccess中,就像这样(我是一个重写noob): 问题是localhost/site/about/总是转发到 localhost/site/blog/about/并更改地址栏。我需要在用户访问localhost/site/blog/about/时提供lo

我在localhost/site有CodeIgniter,在localhost/site/blog的子目录中有Wordpress

每个都可以正常工作-除了我希望站点目录中的某些URL指向Wordpress子目录

我将它们转发到站点文件夹的.htaccess中,就像这样(我是一个重写noob):

问题是
localhost/site/about/
总是转发到
localhost/site/blog/about/
并更改地址栏。我需要在用户访问
localhost/site/blog/about/
时提供
localhost/site/about
上的页面

为了查看
localhost/site/blog/about/
上的页面,我必须在blog子目录中添加RewriteBase指令并更改以下.htaccess中的RewriteRule:

RewriteEngine On
RewriteBase /site/blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/blog/index.php [L]
如果不添加此项,位于
localhost/site/blog/about
的页面将显示CodeIgniter 404错误页面。(重写库实际上似乎没有效果)

最终,该网站将托管在www.site.com上,Wordpress安装将在www.site.com/blog上


我尝试了很多不同的解决方案,但都没有效果。感谢您的帮助。

之所以
site/about/
总是转发到
site/blog/about/
是因为您告诉它:
RedirectMatch Permanent^/site/about//站点/博客/关于

要让
site/about/
停留在URL栏中,但显示
site/blog/about/
中的内容,应执行以下操作:

RewriteEngine On
RewriteRule ^site/about/$ /site/blog/about/ [L]

谢谢你的回复。根据上面的重写规则,CodeIgniter 404错误页面显示在site/about/。
RewriteEngine On
RewriteRule ^site/about/$ /site/blog/about/ [L]