Error Removing index.php from url (Need Help URGENT Please)

#11
[eluser]danmontgomery[/eluser]
[quote author="GK" date="1278010216"]Noctrum, i've also tried without Default controller by using

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


but this time it is showing (404) other methods.[/quote]

Because you don't have any routes defined,

hostelsearch.in/index would be looking for the "index" controller.

The default controller only gets called when one isn't provided. Setting the default controller to "HostelSearch" then calling index.php/index won't call HostelSearch/index. You need to use routing for that. Please read the user guide.

http://ellislab.com/codeigniter/user-gui...uting.html

#12
[eluser]pickupman[/eluser]
Code:
$route['index'] = 'HostelSearch/index';
$route['about'] = 'HostelSearch/about';

#13
[eluser]GK[/eluser]
I guess it was routing to the default controller 'HostelSearch' and not to its default function 'index'. hostelsearch.in was returning a 404 while hostelsearch.in/index or /about was working fine.

#14
[eluser]GK[/eluser]
Hi All,
to elaborate more,
hostelsearch.in/index is routing to hostelsearch.in/index.php/HostelSearch
hostelsearch.in/about is routing to hostelsearch.in/index.php/HostelSearch/about

BUT,
hostelsearch.in is NOT routing to hostelsearch.in/index.php/HostelSearch
and returning a 404.

My .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/HostelSearch/$1 [L]

routes.php:
$route['default_controller'] = 'HostelSearch';

config.php:
$config['index_page'] = "index.php";
$config['uri_protocol'] = "AUTO";



Any solutions??

Thanks

#15
[eluser]pickupman[/eluser]
You need to keep your default controller out of your .htaccess file. Also note when you change this, you need to clear your browsers cache.
When you say you are getting a 404 error, is a server 404, or a CI 404 error. If it is the latter, you can turn on logging in your config file, and possible see what CI is trying to find.

I would also recommend testing different $config['uri_protocol'] string to the ones that are listed in the config.php file. Perhaps your server is not responding properly to auto.

#16
[eluser]GK[/eluser]
Thanks pickupman,

here is what error logs say:
DEBUG - 2010-07-01 15:29:42 --> Config Class Initialized
DEBUG - 2010-07-01 15:29:42 --> Hooks Class Initialized
DEBUG - 2010-07-01 15:29:42 --> URI Class Initialized
ERROR - 2010-07-01 15:29:42 --> 404 Page Not Found --> hostelsearch


Controller Name is : HostelSearch

is defined in the routes with correct case.

Any clue?

#17
[eluser]pickupman[/eluser]
In .htaccess try
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

#18
[eluser]proximityfuse[/eluser]
A question: Does the code in the .htaccess file have any special name or is it just Appache settingscode?

#19
[eluser]pickupman[/eluser]
I know it provides user override to the server's default settings. The server config is AllowOverride All

#20
[eluser]pickupman[/eluser]
It appears to be working correctly or me, but now you need to fix how your created your url's. You should be using something like:
Code:
anchor('about_us', 'About Us');
This will take care of the proper way to create links, because if you wanted to change the domain name or add/remove index.php. anchor() will take care of it all.

Also, make sure you have in config.php
[code]
$config['site_url'] = 'http://www.hostelsearch.in/';


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.