Welcome Guest, Not a member yet? Register   Sign In
base_url not working fine - Please help
#1

[eluser]Saurabh[/eluser]
Hi All,
I am pretty new to CI I am facing some issue deploying an app developed using code igniter,
Please be kind enough to give few minutes of your time to help me
solve this issue.

There is some problem with my deployed app ( thisisnext.info) as the
css etc files are not reachable as the base_url result is wrong.My
homepage opens fine but when i try to open any other page that doesnt
open properly as the base_url is returning the whole url and not only
thisisnext.info and hence the css files are not found.

Just to let you know this ( thisisnext.info) is a subdomain in my
account and I have a subdirectory in public_html from where I am
serving this site.



My htaccess file:

AddHandler application/x-httpd-php5s .php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]


Config.php ( main portion)

$config['base_url'] = "http://www.thisisnext.info/";
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";


Any help pointers are highly appreciated.


Thanks
Saurabh
#2

[eluser]rogierb[/eluser]
Can you post some url examples?

Is sound like you need to set RewriteBase in your .htaccess or a documentroot in you vhost
#3

[eluser]Saurabh[/eluser]
Thanks for looking into the issue.. Here are some uri examples .. all the js files are present in app/js however its trying to find in project/viewAllProjects/app/js.

Please have a look at thisisnext.info ..and click of featured projects etc link on left panel...



URI: http://thisisnext.info/project/viewAllPr...ototype.js
URI: http://thisisnext.info/project/viewAllPr...aculous.js
URI: http://thisisnext.info/project/viewAllPr.../script.js

I am pretty new to php and specially htaccess please help me.

Thanks
Saurabh
#4

[eluser]rogierb[/eluser]
Can you give some more info on you directory structure?
Is project/viewAllProjects your subdirectory?

if so, can you try:
RewriteEngine On
RewriteBase /project/viewAllProjects/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

as your .htaccess
#5

[eluser]Saurabh[/eluser]
Hi,

Thanks for the quick reply ..
I am using an open source named rbs http://www.cogzidel.com/Products/RBS

I am attaching the snapshot of the directory structure..
#6

[eluser]rogierb[/eluser]
It seems RBS does not use base_url(). Very weird. So getting those urls makes perfect sense.

What you can do is find their main template and add
Code:
<base href="<?php echo base_url(); ?>">

to the <head> section to force a base path.




Theme © iAndrew 2016 - Forum software by © MyBB