Codeigniter-重写到.htaccess中包含wordpress安装的子目录
我在localhost/site有CodeIgniter,在localhost/site/blog的子目录中有Wordpress 每个都可以正常工作-除了我希望站点目录中的某些URL指向Wordpress子目录 我将它们转发到站点文件夹的.htaccess中,就像这样(我是一个重写noob): 问题是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/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]