karma
karma

Reputation: 137

Unable to host codeigniter project in a web server

I have created a web project in codeigniter. In my localhost (windows 7) I could run the project with no errors. But when I try to host my project in my university subdomain (the administrator gave me a subdomain to host my files myproject.university.edu.bt). I uploaded all my files via filezilla. When I try to access my page, which starts with a login page. It displays the login button without any of the styles that I have coded for the site. When clicking the login button instead of displaying the next page it gives me an error The requested URL /sasec/login/user_login was not found on this server. Can anybody tell me what I should do to view/display my pages correctly! Here is my .htaccess file. The university server is running on linux

  <IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On

# If your website begins from a folder e.g localhost/my_project then 
# you have to change it to: RewriteBase /my_project/
# If your site begins from the root e.g. example.local/ then
# let it as it is
RewriteBase /

# Protect application and system files from being viewed when the index.php is missing
RewriteCond $1 ^(application|system|private|logs)

# Rewrite to index.php/access_denied/URL
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]

# Allow these directories and files to be displayed directly:
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|public|assets|css|js|images)

# No rewriting
RewriteRule ^(.*)$ - [PT,L]

# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
</IfModule>
<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin
    ErrorDocument 404 /index.php
</IfModule>

Upvotes: 0

Views: 667

Answers (2)

Abdulla Nilam
Abdulla Nilam

Reputation: 38584

Go to config/routs.php

Change this

$route['default_controller'] = '';//give your default controller name
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

in addition

Path - config/config.php

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

Upvotes: 1

Amit Shah
Amit Shah

Reputation: 1380

You will have to probably change something with

RewriteBase /

in your htaccess file, link given below will give you more idea.

https://www.daniweb.com/web-development/php/threads/435526/codeigniter-remove-index-php-while-working-on-virtual-host-on-xampp

Thanks Amit

Upvotes: 1

Related Questions