htaccess not working - have tried everything on forum-newbie

If I type http://localhost/codeigniter/index.php/welcome I get the welcome page.
If I type http://localhost/codeigniter/welcome I get url cannot be found on this server

This is my .htaccess file which is located in folder with index.php

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

I have my codeigniter folder in my apache/htdocs folder (I know this is not secure, but that is another problem I will tackle when I solve my .htaccess problem.

The Rewrite module is loaded eg, but because I'm using apache on windows that perhaps I should load a .dll instead.
I also tried to change the directive Allow Override to ALL
but get an internal server configuration error

<Directory "C:/webserver/apache/htdocs">

Options Indexes FollowSymLinks

# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride None

# Controls who can get stuff from this server.
Order allow,deny
Allow from all

I would appreciate any help
Regards Marea

Have you restarted the server?

Make sure you change this:

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

to this:

$config['index_page'] = "";

in your config.php

<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from

Mine looks like that.

I don't know why override all wouldn't work. I believe that Apache relies on Overrides to do htaccess, so with override none, your htaccesses shouldn't work at all. I would set that to all then try to track down your error, or post it and that part of your log file here.

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt|css|js|favicon\.png)
    RewriteRule ^(.*)$ index.php/$1 [L]

That's the way my .htaccess reads.

It's usually a good idea to IfModule so you don't try to redirect without mod_rewrite loaded. Mind you if you were to use Linux mod_rewrite.c becomes I think the problem lies in the "./codeigniter/index.php/$1" portion. If you have the .htaccess in http://localhost/codeigniter/.htaccess then you are requesting a redirect to http://localhost/codeigniter/codeigniter/index.php/$1.

See if sticking my htaccess code (modify my RewriteCond to match yours first) in http://localhost/codeigniter/.htaccess will work for you. If not, try to fix your httpd.conf file.

Also as pistola mentions, every time you make a change to your httpd.conf you MUST restart Apache to see the changes. This does not apply to .htaccess though of course.

Hope this helps,

yup i have same problem like this, and has solved..Thanks axpen.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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