1

I put my folder as public_html/vote

And this is the default behavior of the server

http://mydomain.com/~voteimbo/  <===the public_html folder
http://mydomain.com/~voteimbo/vote/ <==== the vote folder in public_html

The problem is , if I try routing in route.php, unless I add the index.php in my url otherwise it show 404 (The server 404, not codeigniter)

 e.g. $route["test"] = front_end/index

 http://mydomain.com/~voteimbo/vote/index.php/test <==== work
 http://mydomain.com/~voteimbo/vote/test <==== 404

Here is my setting

config.php

$config['base_url'] = 'http://mydomain.com/~voteimbo/vote/';
$config['index_page'] = '';

route.php

$route['default_controller'] = "front_end/check_date";
$route['404_override'] = '';
$route['test'] = "front_end/index"; 

htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [PT,L] 

Thanks for helping

Update :

Attempted the approach here:

CodeIgniter removing index.php not working

but the output is

Array
(
)

so I wonder what is the problem? thanks

2
  • 2
    Just put a rewrite base on RewriteBase /vote/ Commented Jul 5, 2014 at 3:52
  • Thanks. But it is the same 404 issue Commented Jul 5, 2014 at 3:56

2 Answers 2

2

Okay, assuming (as you stated) that your codeigniter setup is stored in the directory /vote/.

You should be able to do something like this in the htaccess file to be able to access it without the index.php

RewriteEngine on
RewriteBase /vote/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Here is some more reading related to Codeigniter URL's

Sign up to request clarification or add additional context in comments.

Comments

0

You can do the following: Go to your file

app/Config/App.php

Now, alter the variable public $indexPage

Current

public $ indexPage = "index.php";

Delete "index.php" and it will look like this:

public $ indexPage. = "";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.