CodeIgniter htaccess subfolder problem

不羁岁月 提交于 2019-11-30 17:53:26

问题


I want a second website in my domain inside the folder test

www.mydomian.com/test

Apache server running on linux.

But when I load it in my navigator styles, images, helpers can't be found.

My htaccess is like this:

RewriteEngine On

RewriteBase /test

RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|robots\.txt)


RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /test/index.php?/$1 [L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

Thank you in advance

I have tried what you said, placing the htaccess file you gave me in the test folder and the other one in the root directory, it didn't work.

Other options?


回答1:


Try adding a .htaccess file into your test folder instead.

I use this .htaccess content:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

In the folder test I would place another .htaccess, with almost the same content:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /test/index.php?/$1 [L]


来源:https://stackoverflow.com/questions/7527491/codeigniter-htaccess-subfolder-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!