CodeIgniter Forums
htaccess is not working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: htaccess is not working (/thread-9443.html)

Pages: 1 2 3 4


htaccess is not working - El Forum - 06-25-2008

[eluser]Blue Sapphire[/eluser]
Hi!
I have used many codes [available in CI forums] as well as following code in Wiki

Wiki Link for creation htaccess

But nothing has run perfectly on my system. I have following configuration.

Application URL : http://localhost/personal/dev/ci/

Web server : WAMP SERVER 2.0
Apache : 2.0.61
PHP : 5.2.5
Rewrite_Module : Enabled


Made following changes in config file of CI :

$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";

Can some one give me perfect code or help me in modifying he WIKI code so that 'htaccess' can run on my local machine.

Thanks in advance


htaccess is not working - El Forum - 06-25-2008

[eluser]Clooner[/eluser]
It should work the either way. Which version did you try? Did you set in the htaccess file the rewritebase correct? Do you have mod_rewrite running?


htaccess is not working - El Forum - 06-25-2008

[eluser]Zeeshan Rasool[/eluser]
Yar ! i think you have to check this code. Save it wirh .htaccess but remove ‘index.php’ from your config.php file

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

Hope you will get it.
...............JaMzEe


htaccess is not working - El Forum - 06-26-2008

[eluser]Blue Sapphire[/eluser]
Thanks for guidance.
I have checked through "phpinfo()". It is showing me that in "Loaded Modules", there exists "mod_rewrite".
I have removed index.php and now it is like -> $config[’index_page’] = “”;

But sill problem exists. Now I am getting "404 Page Not Found" error, [even typing index.php in the url].
My script location is : "http://localhost/personal/dev/ci/"


htaccess is not working - El Forum - 06-26-2008

[eluser]Yash[/eluser]
Just back to normal first..Remove all changes you made.
Now try to run site.If works then do just this

make htaccess file save this code. Now Try ...


Code:
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
<IfModule mod_security.c>
   SecFilterEngine Off
   SecFilterScanPOST Off
</IfModule>



htaccess is not working - El Forum - 06-26-2008

[eluser]Blue Sapphire[/eluser]
Thanks for the guidance. I rolled back the changes in config file. The script begin to work properly with 'index.php' inclusion.
Then I placed following code in htaccess file.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

RESULTS:
1- http://localhost/personal/dev/ci/ [Works Fine]
2- http://localhost/personal/dev/ci/index.php [Works Fine]
3- http://localhost/personal/dev/ci/index.php/myform [Works Fine]
4- http://localhost/personal/dev/ci/myform [Takes back to default WAMP SERVER page]

NOTE: I have created aliases in WAMP, so my script directory location is outside of WAMP 'WWW' directory.
My directory location for this script is 'E:\personal\dev\ci', whereas WAMP SERVER location is 'c:/wamp/www/
' .

Thanks in advance


htaccess is not working - El Forum - 06-26-2008

[eluser]Yash[/eluser]
Almost done..

Now copy your CI installation into "c:/wamp/www/" so you will have "c:/wamp/www/CI"

Now edit config.php .set base_url to "http://localhost/CI"

remove index.php [optional]

it will work perfectly.

if-> for WAMP you need everything in www folder. [GOOD Habit]...

Else-> Research more...
Enjoy Smile


htaccess is not working - El Forum - 06-26-2008

[eluser]Clooner[/eluser]
[quote author="Yash" date="1214487247"]

if-> for WAMP you need everything in www folder. [GOOD Habit]...

Else-> Research more...
[/quote]

Isn't it possible to define the entire path with rewritebase and leave it outside the www dir?


htaccess is not working - El Forum - 06-26-2008

[eluser]Yash[/eluser]
I guess Answer is Yes but you should to be very good with rewritebase. I mean this is little advance so you should know what you are doing.


htaccess is not working - El Forum - 06-26-2008

[eluser]hcvitto[/eluser]
hi
i need to get "into" yor discussion because i got the same problem. Here's my conf: ( Summer Student quotesSmile )

Application URL : http://127.0.0.1/CodeIgniter/

Web server : xampp server 1.6.6a
Rewrite_Module : Enabled

Made following changes in config file of CI :
$config['base_url'] = "http://127.0.0.1/CodeIgniter/";
$config[’index_page’] = “”;


This is my .htaccess file in C:\Programmi\xampp\htdocs\CodeIgniter

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

And here are the results:
1- http://localhost/CodeIgniter/ [Works Fine]
2- http://localhost/CodeIgniter/index.php [Works Fine]
3- http://localhost/CodeIgniter/index.php/about/ [Works Fine]
4- http://localhost/CodeIgniter/about/ [Takes back to default xampp SERVER page]

Any idea about that?
Thank
Vitto