htaccess not working - have tried everything on forum-newbie

#1
[eluser]lollylegs[/eluser]
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 mod_rewrite.so, 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
</Directory>

I would appreciate any help
Regards Marea
Australia

#2
[eluser]Unknown[/eluser]
Have you restarted the server?

#3
[eluser]outrage[/eluser]
Make sure you change this:

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

to this:

$config['index_page'] = "";

in your config.php

#4
[eluser]axpen[/eluser]
Code:
<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

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.

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

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 mod_rewrite.so. 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,
--Alex

#5
[eluser]Unknown[/eluser]
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.