如何从CodeIgniter3安装中删除index.php在子目录中使用Wordpress在root上?

时间:2015-05-23 07:00:41

标签: wordpress .htaccess codeigniter codeigniter-3

所以问题的标题有点难以提出。这是交易,CI3安装是这样的:www.mydomain.com.au/apps/TGPS其中TGPS是CI应用程序。此外,在Web文件夹的根目录上有一个Wordpress安装。我的问题是,我需要压缩URL的.htaccess设置是什么: www.domain.com/apps/TGPS/index.php/controller/function 对此: www.domain.com/apps/TGPS/controller/function

目前我有这个:

enter image description here

顶级.htacess是这样的:

# BEGIN WordPress
RewriteRule ^/apps($|/) - [L] 
# END WordPress

TGPS中的.htaccess是:

<IfModule mod_rewrite.c>
    RewriteEngine On

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    #This last condition enables access to the images and css folders, and the robots.txt file
    RewriteCond $1 !^(index\.php|public|images|robots\.txt|css)
    RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

并且应用程序中的.htaccess是标准的。

似乎我尝试的一切都破坏了Wordpress,CodeIgniter或没有效果。任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:0)

乍一看,你错过了重写基础:

RewriteBase /apps/TGPS/

答案 1 :(得分:0)

试用下面的代码

    RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php
RewriteRule ^index\.php$ / [L,R=301]

然后将www转为非www:

RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]