Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.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

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
从CI和Wordpress中删除index.php_Php_Wordpress_Codeigniter - Fatal编程技术网

从CI和Wordpress中删除index.php

从CI和Wordpress中删除index.php,php,wordpress,codeigniter,Php,Wordpress,Codeigniter,我在根文件夹上找到了CI,在子目录上找到了Wordpress 经过几天的努力,我发现问题是: -CI web配置在WP web.config之前读取 因此,成功删除了CI index.php,但没有删除WP 访问website.com调用CI web.config,已处理。 访问website.com/blog调用CI web.config,已处理。 如果URL不包含博客,只需添加index.php 如果URL包含blog,请在网站之后添加index.php,然后在blog之后添加另一个inde

我在根文件夹上找到了CI,在子目录上找到了Wordpress

经过几天的努力,我发现问题是: -CI web配置在WP web.config之前读取 因此,成功删除了CI index.php,但没有删除WP

访问website.com调用CI web.config,已处理。
访问website.com/blog调用CI web.config,已处理。

如果URL不包含博客,只需添加index.php
如果URL包含blog,请在网站之后添加index.php,然后在blog之后添加另一个index.php

问题:
如何匹配URL“如果URL有blog,那么添加另一个index.php”? 如果我错了,请纠正我

任何关于确定CI目录上正确网络配置的帮助都将不胜感激

original URL:

可湿性粉剂

  website.com/index.php/blog/index.php/ 



website.com/en/user => codeigniter with the controller User
website.com/blog/hello-world => error 404
website.com/blog/index.php/hello-world => Good result

/apps
/system
/blog
   ../web.config WP =>remove WP index.php
   ../index.php

/web.config CI =>remove CI index.php
/index.php
删除CI index.php的web配置

 <?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>   
   <rewrite>
    <rules>
        <rule name="RuleRemoveIndex" stopProcessing="true">
            <match url="^(.*)$" ignoreCase="false" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/>
        </rule>

    </rules>
    </rewrite>

    </system.webServer>
 </configuration>
   <?xml version="1.0" encoding="UTF-8"?>
  <configuration>
    <system.webServer>
    <rewrite>
        <rules>
            <rule name="WordPress Rule 1" stopProcessing="true">
                <match url="^index\.php$" ignoreCase="false" />
                <action type="None" />
            </rule>
            <rule name="WordPress Rule 2" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
                <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
            </rule>
            <rule name="WordPress Rule 3" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
                <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
            </rule>
            <rule name="WordPress Rule 4" stopProcessing="true">
                <match url="^" ignoreCase="false" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                </conditions>
                <action type="None" />
            </rule>
            <rule name="WordPress Rule 5" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
                <action type="Rewrite" url="{R:2}" />
            </rule>
            <rule name="WordPress Rule 6" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                <action type="Rewrite" url="{R:2}" />
            </rule>
            <rule name="WordPress Rule 7" stopProcessing="true">
                <match url="." ignoreCase="false" />
                <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
    </rewrite>
     </system.webServer>
   </configuration>
结果:
404错误

解决方案在每个目录中使用web.config。 当我删除CI web.config上的规则时,我发现我可以很好地加载WP

我在CI web.config上使用它

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>   
   <rewrite>
    <rules>
        <rule name="RuleRemoveIndex" stopProcessing="true">
            <match url="^(.*)$" ignoreCase="false" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/>
        </rule>

    </rules>
    </rewrite>

    </system.webServer>
 </configuration>
   <?xml version="1.0" encoding="UTF-8"?>
  <configuration>
    <system.webServer>
    <rewrite>
        <rules>
        <clear/> => add clear to clear the predefined connection strings
            <rule name="WordPress Rule 1" stopProcessing="true">
                <match url="^index\.php$" ignoreCase="false" />
                <action type="None" />
            </rule>
            <rule name="WordPress Rule 2" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
                <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
            </rule>
            <rule name="WordPress Rule 3" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
                <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
            </rule>
            <rule name="WordPress Rule 4" stopProcessing="true">
                <match url="^" ignoreCase="false" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                </conditions>
                <action type="None" />
            </rule>
            <rule name="WordPress Rule 5" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
                <action type="Rewrite" url="{R:2}" />
            </rule>
            <rule name="WordPress Rule 6" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                <action type="Rewrite" url="{R:2}" />
            </rule>
            <rule name="WordPress Rule 7" stopProcessing="true">
                <match url="." ignoreCase="false" />
                <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
    </rewrite>
     </system.webServer>
   </configuration>

在WP web.config上

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>   
   <rewrite>
    <rules>
        <rule name="RuleRemoveIndex" stopProcessing="true">
            <match url="^(.*)$" ignoreCase="false" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/>
        </rule>

    </rules>
    </rewrite>

    </system.webServer>
 </configuration>
   <?xml version="1.0" encoding="UTF-8"?>
  <configuration>
    <system.webServer>
    <rewrite>
        <rules>
        <clear/> => add clear to clear the predefined connection strings
            <rule name="WordPress Rule 1" stopProcessing="true">
                <match url="^index\.php$" ignoreCase="false" />
                <action type="None" />
            </rule>
            <rule name="WordPress Rule 2" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
                <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
            </rule>
            <rule name="WordPress Rule 3" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
                <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
            </rule>
            <rule name="WordPress Rule 4" stopProcessing="true">
                <match url="^" ignoreCase="false" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                </conditions>
                <action type="None" />
            </rule>
            <rule name="WordPress Rule 5" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
                <action type="Rewrite" url="{R:2}" />
            </rule>
            <rule name="WordPress Rule 6" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                <action type="Rewrite" url="{R:2}" />
            </rule>
            <rule name="WordPress Rule 7" stopProcessing="true">
                <match url="." ignoreCase="false" />
                <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
    </rewrite>
     </system.webServer>
   </configuration>

=>添加清除以清除预定义的连接字符串

尝试将配置文件合并为一个(在根目录中),并使用
blog/