简体   繁体   中英

How do I setup CodeIgniter htaccess in a sub-folder?

I have setup a CodeIgniter Application on my server at the following URL:

http://subdomain.domainame.com/something1/something2/

(I have used something1 and something 2 as examples)

Now, I can access the application perfectly fine when using the above URL and can add /index.php/controller/action etc to the end.

I have tried to setup a .htaccess file in the same directory the application is hosted but it doesn't seem to be working.

The .htaccess file contains the following:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ something1/something2/index.php?/$1 [L]

This is giving me a 500 Internal Server Error.

Can anyone shed some light on this?

I think I might have solved this.

Changed:

RewriteRule ^(.*)$ something1/something2/index.php?/$1 [L]

To:

RewriteRule ^(.*)$ /something1/something2/index.php?/$1 [L]

I am no longer getting an internal server error.

In order to assist anyone coming across this question, here is my full .htaccess file:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /something1/something2/index.php?/$1 [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM