.htaccess in a subfolder

The main site launches WordPress with .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I'm going to create a CodeIgniter application in a subdirectory. site.com/online/ Just adding the CI.hta file to a subfolder will not work. CI.htaccess:

RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt|img|styles|js)
RewriteRule ^(.*)$ /index.php?/$1 [L]

Is it possible to merge two .htaccess files or do something with .htaccess in a subfolder of CI? Thank.

UPD. Thanks for the answers, I tried all the options and eventually moved the project to a subdomain.

+3
source share
3 answers

First, your .htaccess should look like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} !^GET\s/+online/ [NC]
RewriteRule . /index.php [L]
</IfModule>

#Then add this for CI handling in the same .htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !index\.php [NC]
RewriteRule ^online/(.*)$ online/index.php?/$1 [L,NC]

You can then delete (or rename) .htaccess into a subfolder online.

+3
source

Try this for codeigniter.htaccess:

RewriteEngine on
RewriteBase /online
RewriteCond $1 !^(index\.php|robots\.txt|img|styles|js)
RewriteRule ^(.*)$ /index.php?/$1 [L]

Wordpress.

+1

AllowOverride? docs FileInfo mod_rewrite.

+1

All Articles