简体   繁体   中英

base_url working in main controller but not in sub controller/views

I've been working with CodeIgniter for a while now and I already had my base_url working. I recently moved to CentOS 7 and had to set my server up all over again. It was a pretty smooth transition, but I've been tinkering around with some of the modules and such. Long story short, my base_url is no longer working and I cannot figure out why.

base_url is currently set to http://IP/Directory/

index is set to ' '

url helper is loaded

.htaccess file looks like this:

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

httpd has been configured. phpd has been configured. mysqld has been configured. The last thing I did before I noticed that it broke was I set selinux to permissive.

To elaborate on how it is broken-- When at the actual base_url, everything is working perfectly. When I go into a subdirectory (another controller/view) it no longer recognizes the base_url. I found that if I add a "../" it works for some strange reason in that subdirectory, but it breaks the main controller. It's acting as if the base_url is equal to the current directory level rather than the actual base_url that I specified.

Edit: Directory Layout -

www > 
     html > 
            websitefolder > 
                            css|img|font|codeigniterfolders

Also forgot to mention another thing I did before it broke was moved the css, img, and font folder to assets subdirectory, but I've moved them back to base_url root.

Just a heads up- I resolved my issue by changing the way I use the base_url to instead of what I initially learned what to use. Was still having the issue in CI 3.

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