Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter site in subdirectory, htaccess file maybe interfering with htaccess file in main directory?

In my CodeIgniter site (hosted on GoDaddy), navigating to any page but the index gives me this error:

No input file specified.

Googling around, it seems like the cause must have something to do with my .htaccess situation. The way this is set up, and maybe this can eventually change, is that my CI site is in a subdirectory of the main domain. The CI site and main domain each have their own .htaccess files. The CI htacess file is located in the applications folder:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /SubDomain/index.php?$1 [L]
</IfModule>

And here's the main htaccess file is two levels up from the CI one, reading thusly:

RewriteEngine on
RewriteCond %{SERVER_PORT} 80
rewriterule ^(.*)$ https://www.MainDomain.org/$1 [r=301,nc]

I am afraid these two sets of re-write rules are conflicting with each other and I really have no idea what to do about it. I can alter either htaccess file and would really like to get them working together in peace and harmony. It's also possible, however, that this has nothing whatsoever to do with htaccess.

like image 404
patricksayshi Avatar asked Dec 15 '22 17:12

patricksayshi


1 Answers

The CI .htaccess shouldn't be in the application folder; it should be in the root of theSubDomain folder. e.g. /public_html/SubDomain/.htaccess

Also, in that .htaccess, you need to set the RewriteBase:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /SubDomain
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?$1 [L]
</IfModule>
like image 118
stormdrain Avatar answered May 16 '23 08:05

stormdrain