CodeIgniter Forums
htaccess not working - have tried everything on forum-newbie - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: htaccess not working - have tried everything on forum-newbie (/showthread.php?tid=12058)



htaccess not working - have tried everything on forum-newbie - El Forum - 10-03-2008

[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


htaccess not working - have tried everything on forum-newbie - El Forum - 10-03-2008

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


htaccess not working - have tried everything on forum-newbie - El Forum - 10-03-2008

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

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

to this:

$config['index_page'] = "";

in your config.php


htaccess not working - have tried everything on forum-newbie - El Forum - 10-03-2008

[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


htaccess not working - have tried everything on forum-newbie - El Forum - 01-19-2009

[eluser]Unknown[/eluser]
yup i have same problem like this, and has solved..Thanks axpen.