Duplicated and appended URL |
I'm using redirect('login','refresh');
and it worked fine in my localhost, but on uploaded onto server it gives me : http://domainxxx/main/%20//domainxxx/login I'd tried several things according to what I saw like removing the 'refresh' changing the switch case for 'refresh' in system url helper fill in the config['base_url'] = 'domainxxx'; using header location to replace redirect() but it still gives me : http://domainxxx/main/%20//domainxxx/login Has anyone experienced this before ? Another thing is that how I can see the problem with implementing CI 3 ? All I saw when placed on hosting or even in localhost whenever error pops, it only gives some include or system core exception warning error without pointing where/what the problem is Hopefully anyone can share a light on this problem Thanks in advance,
After a few try out, I found out that the problem is when redirecting is calling another controller
Like from main.php controller to login.php controller It's like...main/logout is actually doing unset and then redirecting to login Also further...it seems all SESSION data isn't flushed and need to do refreshing the page to have it updated somehow It feels like something is missing in the server part, but I have no idea what
The %20 character is the html replacement for a space.
Check your code if your base url or the url you are trying to redirect to, start or end with a space character (by mistake). I use the redirect statement in a lot of situations. I've never encountered any problems when redirecting to a url that refers to another controller. It could go wrong when your controllers are in subfolders. But I don't see that in your description.
Thanks for answering,
It works in my xampp development environment so space shouldn't be the case, but I'll double check it later. And yes...there's no folder involved...they're all under controller folder. Thanks again
A lot of configuration options and the server's redirect configuration can come into play when using redirect() or site_url() (used by redirect() when the first parameter for redirect() doesn't include the protocol). The most obvious configuration options to check are 'base_url', 'index_page', and 'url_suffix'.
Additionally, if you've made any changes to the system files, it would be a good idea to undo those changes/replace them with the original files to see if the problem is caused by something that was changed. In general, changing a system file is a last resort, especially when things work fine in development (which indicates a server configuration issue or something specific to the differences between the server and development machines, like Windows' lack of case-sensitivity in its file system). |
Welcome Guest, Not a member yet? Register Sign In |