.htaccess,codeigniter,godaddy , No input file specified. on calling a Codeigniter route

No input file specified. on calling a Codeigniter route


Tag: .htaccess,codeigniter,godaddy

I set as base url the next link:

$config['base_url'] = 'http://jocuri-gratis.us/ady/';

I have a route

$route['first'] = "first/first";

and I set in the .htaccess:

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

but when I call the link


all I get is the message "No input file specified."" and I don't know why.

P.S. My host is godaddy


Try this out :

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


Force WWW when URL contains path using .htaccess

I'm having a problem with my URL and my sessions. I wish to have ALL website pages be forced to use www. As it looks like now, the website looks like this: www.example.com into www.example.com example.com into www.example.com www.example.com/example/ into www.example.com/example/ example.com/example into example.com/example (this is what's wrong) This is...

Openshift redirect to https using flask-base example

I'm trying to run my flask based app on free gear on Openshift only on https. Following this - I have added the .htaccess file to the root of my repo but it seems to be ignored, as it is not redirecting. The article talks about a wsgi directory but...

mod-rewrite to remove a folder

I have the following URL http://www.example.com/folder1/folder2/file.php I want to redirect it to http://www.example.com/demo/folder1/file.php I tried this, but it does not work: RewriteCond %{HTTP_HOST} www.example.com RewriteCond %{REQUEST_URI} ^folder RewriteRule /demo/folder(.*) /folder1/folder2/$1 ...

jquery sortable - gives empty array in response

I am using jquery ui sortable for my codeigniter website but when i am sorting data it will give me empty array in console. please check and let me know my mistake. <script> $(document).ready( function() { $("#sortme tbody").sortable({ update : function (event, ui) { // console.log(ui); serial = $('#sortme tbody...

read more function with codeigniter

i am trying to create a readmore function in codeigniter where the readmore link will be linked to a controller which would show all the data about that particular id....i am kind of confused on how to go about it... i tried... <?php $research_detail_url = site_url()."/research/research_details"; //echo json_encode($research) if($research) {...

How generate hyperlinks for news show in codeigniter

i created a news panel where we use this code for displaying news : <marquee direction="up" > <?php $query = $this->db->get('news'); foreach ($query->result() as $row) { echo $row->news; echo $row->urladdress; echo '<br/>'; } ?> </marquee> where it show correct , all data get fetched and run marquee good , but...

Excluding certain pages from being redirected to https

I'm using the following rules on my WordPress website to: Redirect all http pages to https Redirect the careers page to http <IfModule mod_rewrite.c> RewriteEngine On # Go to https if not on careers RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} !^/careers$ [NC] RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R,L] # Go to http if...

Cron job with CodeIgniter using wget

I am pretty new to setting up cron jobs. What I've done so far is set one up to run every 5 minutes using the following script: */5 * * * * wget -q localhost:8888/example/index.php/controller/function When I run just the wget part from the command line, it works perfectly. But...

Allow space and other special characters in htaccess url rewrite

Hi everyone i have this URL: orderprod_cntr/147/ok2%20-%20val1%20val2%20val3%20val4 When ever i open this URL i get 404 error. The htaccess rule that i am using at present is: RewriteRule orderprod_cntr/([-\w]+)/([-\w]+)/?$ controller/orderprod_cntr.php?id1=$1&id2=$2 [L] The error is occurring due to %20 in the URL, without it works fine. Please tell me the correct...

htaccess errors after upgrading Apache from 2.2 to 2.4

I use 3 hosting for my websites, all of them have the same rules in htaccess. One of the hosting was upgraded from Apache 2.2 to 2.4 and now I am getting errors spam and I don't know how to fix it without lossing the rule. [Mon Jun 15 19:38:33.189697...

Best way to block countries [on hold]

I was requested to prevent access to a website. There are two ways I know I can choose - 1. At apache level (a tool like this: http://www.ip2location.com/blockvisitorsbycountry.aspx) which generates a long htaccess file with list of IP ranges. The other way I know of is using PHP (be it...

Pretty URLs aren't working after upgrade to Mediawiki 1.24.2

So I am moving a Mediawiki site of mine to a new server. The version 1.20.3 worked fine on the old server running Ubuntu 12.04. However, when I copied everything over to my new server running Ubuntu 14.04 it didn't. So after messing with it for a while I decided...

after using mod_rewrite link are not found

I was changed my url from http://example.com/admin/courses.php?id=1001 to http://example.com/articles/1001 usig this code RewriteEngine On RewriteRule articles/([A-Za-z0-9-]+)/?$ admin/courses.php?id=$1 [NC,L] but after changing the url, all the css, images, js link of course.php page is automatically change from http://example.com/admin/css/style.css to http://example.com/articles/css/style.css I need to help...

Redirection loop (URL rewriting)

I'm trying to rewrite my website URLs. I have: http:// website.com/v2/message.php?ID2=123 I want: http:// website.com/v2/message-123.php I tried something in my htaccess but I've a redirection loop :'( Here is my .htaccess: RewriteCond %{QUERY_STRING} ^ID2=([0-9]+)$ RewriteRule message.php? http://website.com/v2/message-%1.php? [L,R=301] Can someone help me with this?...

REST API with token based authentication

I want to develop a web site with AngularJS. On the backend side I will use Codeigniter REST framework. I have some security issues and I don't want to start developing without fixing them on my mind. I don't want to use something like api key because it will be...

How to rewrite example.com/catelogue.php?page=3&cat1=fruit&cat2=apple with .htaccess

Can anyone help me with .htaccess rewrite url, I am new to it and stuck with this below problem i have this urls http://example.com/catelogue.php?page=3 http://example.com/catelogue.php?page=3&cat1=fruit&cat2=apple and i want this to be http://example.com/catelogue http://example.com/catelogue/fruit/apple Below is my .htaccess file, but here the problem is I have achieved this (example.com/catelogue/fruit/apple) but I...

Remove plus sign from url using .htaccess

My current url is: http://localhost/mywbsite/search/one+piece/149 I want to change link to like this http://localhost/mywbsite/search/one-piece/149 I have already .htaccess file with this code Options -MultiViews RewriteEngine On RewriteBase /indianrealitybytes/ RewriteCond %{THE_REQUEST} /search_advance\.php\?keywords=([^&]+)&f=([^\s&]+) [NC] RewriteRule ^ search/%1/%2? [R=301,L] RewriteRule ^search/([^/]+)/([^/]+)/?$ search_advance.php?keywords=$1&f=$2 [QSA,L,NC] I don't know where to change to remove plus(+) sign...

Rewrite non-dynamic pages using htaccess

I've been banging my head since many hours on this and I am unable to come up with a solution. What I need to get done. domain.com/page.php => domain.com/page/ domain.com/category1-name1.php => domain.com/category1/name1/ domain.com/category2-name1.php => domain.com/category2/name1/ Details: I have couple of files with the following names & I want them to...

codeigniter session object expired availability

This might be a silly question. Once a user has been logged in, if session expires I want to redirect him to a "lockscreen" instead to a "login" page. I want to send to the lockscreen some session data (like img-src and loginname) So, here's the question. Does session object...

How to modify CodeIgniter calendar to handle multiple events per day?

I am creating a calendar without jquery calendar plugin. I could retrieve the data which is in the database to the calendar. But when there are multiple data per day only one data comes to the calendar view. I want it to be like this when there is multiple data....

Codeigniter URL routing issues in .htaccess

Before you mark it as duplicate FIY I have tried all solutions I could find on SO. The url is www.deltadigital.ca config file (if I use $config['base_url'] = 'http://www.deltadigital.ca' - it doesnt work at all) //$config['base_url'] = 'http://www.deltadigital.ca'; $root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST']; $root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); $config['base_url'] = $root;...

Codeigniter Form Validation Rule for match (password)

I am trying to write Form validation rules in my Controller to submit Change Password form in which I am checking the old password too. I am getting the old password(current) from db and placing it in a hidden input field. My Rules are simple and are given below $config=array(...

htaccess query string redirect not working correctly

I have a situation where I want to actually see the url variable even though the rest of my htaccess site uses readable URLS. The issue is that it is simply showing up as a page not found... This works... RewriteRule ^files/(.+)/from_all_files/$ pages/file.php?slug=$1&from=all-files This does not work RewriteRule ^files/(.+)?from=all-files$ pages/file.php?slug=$1&from=all-files...

.htaccess Mod_Rewrite inconsistent

Here is my .htaccess file: RewriteEngine On #Working rules: RewriteRule ^privacy$ privacy.php [L] RewriteRule ^terms$ terms.php [L] RewriteRule ^team$ team.php [L] RewriteRule ^candidates$ candidates.php [L] RewriteRule ^clients$ clients.php [L] #Not working rules: RewriteRule ^article/([^/]*).*$ article.php?id=$1 [L] RewriteRule ^job/([^/]*).*$ job.php?id=$1 [L] RewriteRule ^contact/([^/]*).*$ contact.php?location=$1 [L] The top rules are all working...

Page doesn't load after .htaccess redirect with parameters

I recently hosted my website on 000webhost.com and once I hosted it, I logged in to check its working. When I click on a link such as message or profile that contains three parameters such as url, id and ref, the page gets redirected but the profile/message page doesn't load....

how to multiply two column names using codeigniter validation rule

I have three columns.The product of two columns get into third column name income_amount using codeigniter validation rule.the first column is crop_quantity and the second is per_rate controller $this->form_validation->set_rules('crop_quantity', 'Crop Quantity', 'required|numeric'); $this->form_validation->set_rules('per_rate', 'Per Rate', 'required|numeric|callback_get_product'); $this->form_validation->set_rules('income_amount', 'Income Amount', 'required|numeric');...

Group by date mysql and codeigniter

I have table like this: date_time value 2015-06-20 10:00:00 10 2015-06-20 9:00:00 6 2015-06-21 6:00:00 5 2015-06-22 11:00:00 12 2015-06-22 10:00:00 11 2015-06-23 4:00:00 20 I want to get the total value of each date Currently I have this on CodeIgniter but is not working: $this->db->group_by('date_time'); $query = $this->db->get('table_a'); Any...

Add custom error messages to CI validation_errors()

There's a way to add custom error messages to CodeIgniter validation_errors();? Example, if I wanted a field with a 123456 value, and the user inputs 12345 I'd want to set a message to say: The number 6 is required! And any other custom rules I may want to add. Like...

post serialized data through using jquery load method in codeigniter

Here is my code. <form id='user'> <label for="name">Name :</label> <input type="text" id="name" name="name"/> <label for="email">Email :</label> <input type="text" id="email" name="email"/> <input type="submit"/> </form> <div id="output"></div> jQuery: $('#user').on('submit',function(event){ event.preventDefault(); var data=$(this).serialize(); adddetails(data); }); function adddetails(data){ var url='http://localhost/projectname/index.php/users/adddat';...

Associative array turned into where OR clause in Codeigniter

using CI I'm trying to set up query with three parameters: user_id, content_type and content_id in which content_id is array of IDs. So I need to get up with something like this: SELECT name FROM content WHERE user_id = 2 AND content_type = file AND (content_id = 4 OR content_id...

How to call this function for every controller in codeigniter

My situation is that, I have 20 controllers in my website, where I have a function like this. $this->lang->load("main", $this->session->userdata("lang_code")); How can I load this function in all the 20 controllers without adding it individually to the __constructor of every controller?...

Best way to serialize a JOIN SQL query to JSON

I can't find a good title for my question. I'm doing a Restful API /JSON My problem is: I have got two tables: Product: id, name Prices: id_product, price Product 1--* Prices (One product have got multiples prices) So, If I want to export the next information in JSON products:...

Setting session variable after destroying previous session

Why isn't the session variable value available on the second page load when I click the "Fake Login" link? class Fake_login extends CI_Controller { function __construct() { parent::__construct(); echo $this->session->userdata('session_id') . '<br>'; // First Page Load: ee3c7c5da6e465605cd57ad699aacdb3 // Second Page Load: c82adf312f123d56e3b7b6ab5ec6cafa echo $this->session->userdata('variable') . '<br>'; // First Page Load:...

Rewrite url not working in htaccess

I have website. I just want to rewrite url using .htaccess Here is the code which I want to rewrite: RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} /search_data.php\?keywords=([^&]+)&f=([^\s&]+) [NC] RewriteRule ^/search_data.php/?$ /search/%1/%2? [R=301,L,NC] this the current url http://localhost/mywbsite/search_data.php?keywords=one+piece&f=149 I want to convert this to this http://localhost/mywbsite/search/one-piece/149 I tried above code but...

Array in Foreach (CodeIgniter)

I want to use array in foreach loop but failed, here is my code: foreach($this->db->get_where('mytable', array('result' => '1 or 2', 'id' => 'foo'))->result_array() I think 'result' => '1 or 2'piece has a problem but I couldn't find out how can I use array in this kind of foreach. I want...

mod_rewrite - force redirecting to rewritten URL

I have following URL [1]: www.domain.com/?search=somequery which i want to redirect to [2] www.domain.com/search/somequery I am using following code in my .htaccess: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^search/(.*)$ /?search=$1 [L] Code above works kind of fine since server understands both URLs:...

Apache Regex How To Get This Value

I have a URI like this: http://example.com/demo/makemoney?matchtype=chancee&network=agagag&ifmobile=1&placement=nyc&adposition=111&copy=25&pid=123&zid=231&mid=234&cid=342&param1=zaleemm&param2=vatansvr I want to get makemoney and after "?" character values. In my .htaccess file write this rule: RewriteRule ^demo/(.*)?(.*)$ demo.php?utm_campaign=$1&$2 [L,NC] But only utm_campaign I get in $_GET super globals. What's true regex?...

Make dynamic links (with ?) return error 404 not found

Using .htaccess (are there any other solutions?) is there a way to make all dynamic links (links containing the sign ?) of a site return a 404 not found response header? For example: http://www.example.com/?bla_bla - will return 404 http://www.example.com/test/index.html?no_redirect=true - will return 404...

How to write .htaccess file for AJAX page

I am working on a website which i am going to develop as a CMS. So i am writing .htaccess file. page link and url working fine, but when i performing ajax request then i am getting 404 error for the url. I am placing my .htaccess file code and...

How to add support gd library to server

I have applied following code. But didn't find any solution. How I can add support gd library to server. public function addreqdoctor() { if($_FILES['userfile']['name']){ $ext = end(explode(".", $_FILES['userfile']['name'])); $new_name = time()."_".rand(1,10000).'.'.$ext; $basic['picture'] = $new_name; $config['upload_path'] = './doctors/'; $config['allowed_types'] = 'gif|jpg|png'; $config['file_name'] = $new_name; $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) {...

Redirect specific Url variables

My site used to generate URLs like this: /data.php?s=1432862823&type=basic I have modified the program so the new URLs generated are: /d.php?s=1432862823&t=basic Since some people have bookmarked the old URLs I want to write a Rewrite rule that will get them to the new url. I've not this so far: RewriteEngine...

Unable to connect to your database server using the provided settings in Codeigniter

Actually I'm trying to configure my codeigniter live file to localhost. I have, created a database called test_bs then imported the tables Then change the base_url like $config['base_url']=http://localhost/gu_ci/'; and $config['index_page']='index.php'; in config.php And then did a change on database.php,Which contains $active_group = 'default'; $active_record = TRUE; $db['default']['hostname'] = 'localhost'; $db['default']['username']...

When I click to the next page on pagination,it goes to 404 error in codeigniter

In my News.phpcontroller,i'm having the below code: public function index() { $data['title'] = 'Database Details'; $config = array(); $config['base_url'] = base_url("news/index"); $config['total_rows'] = $this->news_model->record_count(); $config['per_page'] = 5; $config['uri_segment'] = 3; //$config['use_page_numbers'] = TRUE; // $config['page_query_string'] = TRUE; $choice = $config["total_rows"] / $config["per_page"]; $config["num_links"] = round($choice); $this->pagination->initialize($config); $page =...

.htaccess allow image to display directly

I have many files including images, php& js scripts and subfolders. I need to redirect to index.php for any uri using .htaccess. for example: www.example.com/test should be redirect to index.php But images should not be redirected to index.php. Instead it should be printed directly in browser. For example: www.example.com/sample.jpg should...

using if else with codeigniter return value

I am using codeigniter framework for one of my inventory management systems. I prefer using php due to its variable functionality which makes things easier. So I am trying to get the username from session and then check the database for the level of the user and accordingly he should...

Codeigniter Select JSON, Insert JSON

I have very simple users database: user_id, user_name, user_email My model this: class Users extends CI_Model { private $table; private $table_fields; private $table_fields_join; function __construct() { parent::__construct(); $this->table = 'users'; $this->table_fields = array( $this->table.'.user_id', $this->table.'.user_name', $this->table.'.user_email' ); $this->table_fields_join = array(); } function select(){ $this->db->select(implode(', ', array_merge($this->table_fields, $this->table_fields_join)));...

Pattern matching in htaccess rewrite condition

I have a rewrite condition in an .htaccess file which is used to 'not' force specific URLs to use a HTTPS connection but it's matching erroneously on other URLs at present, here's the rewrite rule... RewriteCond %{HTTPS} off RewriteCond !/go/ [NC] RewriteCond %{HTTP_HOST} ^app\.ihasco\.co\.uk [NC] RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] And...

Why same .htaccess commands working differently in localhost and server?

I have the following .htaccess command for redirection of php pages RewriteRule ^(.*)$ index.php/$1 [L] This code is working in localhost.It is not working in web server. But when code is slightly modified it works in server. RewriteRule ^(.*)$ index.php?/$1 [L] Why is this happening?...

Htaccess rewrite URL with virtual directory and 2 variables

its my URL... result.php?team=arsenal&player=ospina I want to like this mysite.com/virtualdirectory/arsenal/ospina.html I tried this code.. cant work.. Not Found RewriteRule ^(.*)/(.*)/(.*).html$ result.php?team=$2&player=$3 [L] The requested URL /subfolder/arsenal/ospina.html was not found on this server. Apache/2.2.8 (Win32) PHP/5.2.6 Server at localhost Port 80 Thanks for helps, Best regards!!...