在根目录中使用Wordpress从子文件夹中的Codeigniter URL中删除index.php
我的服务器子文件夹中的Codeigniter应用程序以及文档根目录中的Wordpress安装出现了一些问题。如果我用在根目录中使用Wordpress从子文件夹中的Codeigniter URL中删除index.php,php,wordpress,.htaccess,codeigniter,Php,Wordpress,.htaccess,Codeigniter,我的服务器子文件夹中的Codeigniter应用程序以及文档根目录中的Wordpress安装出现了一些问题。如果我用.htaccess隐藏Codeigniter URL的index.php /codeigniter/.htaccess DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond $1 !^(index\.php|user_gui
.htaccess
隐藏Codeigniter URL的index.php
/codeigniter/.htaccess
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|user_guide|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/(codeigniter).*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
然后导航到www.mysite.com/codeigniter/my_controller/my_function
,我得到了一个404错误没有指定输入文件。
我发现,在重写规则^(.*)$index.php
之后添加一个?
可以解决codeigniter 404错误
/codeigniter/.htaccess
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|user_guide|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/(codeigniter).*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
然而,我现在得到了Wordpress 404错误,因此,如果我在/codeigniter/.htaccess
中用index.php?
替换index.php
,在/.htaccess
中的Wordpress重写规则,重写cond%{REQUEST\u URI}^/(codeigniter)。*$
被忽略。有没有更好的方法来处理这个问题
提前谢谢 codeigniter目录中的
RewriteBase
应该是/codeigniter/
RewriteBase /codeigniter
否则,对
index.php
的重写将转到wordpress的路由器。谢谢,我刚刚发现,仅供参考RewriteCond%{REQUEST\u FILENAME}上的RewriteEngine-f RewriteCond%{REQUEST_FILENAME}-重写规则。*index.php/$0[PT,L]
也可以。