Part of the EllisLab Network
   
1 of 2
1
htaccess is not working
Posted: 25 June 2008 08:28 AM   [ Ignore ]  
Summer Student
Total Posts:  20
Joined  09-29-2007

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

Profile
 
 
Posted: 25 June 2008 03:03 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  152
Joined  06-06-2007

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?

Profile
 
 
Posted: 25 June 2008 10:33 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  121
Joined  06-05-2008

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

 Signature 

zEeShAn (Mapleweb, Lahore)
I can be one of the best programmer in the world, if GOD give me the…... source code…!!! tongue rolleye


Contact Me Freelance Development
Online Job Seeking Need a working relationship

Profile
 
 
Posted: 26 June 2008 02:01 AM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  20
Joined  09-29-2007

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/”

Profile
 
 
Posted: 26 June 2008 02:25 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  375
Joined  10-22-2007

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 ...

<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>
 Signature 

Blogmer - Open source blogging software based on codeigniter
Blogmer Documentation
Web Design company and FREE PHP MySQL Webhosting

Profile
 
 
Posted: 26 June 2008 03:25 AM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  20
Joined  09-29-2007

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

Profile
 
 
Posted: 26 June 2008 03:34 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  375
Joined  10-22-2007

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

 Signature 

Blogmer - Open source blogging software based on codeigniter
Blogmer Documentation
Web Design company and FREE PHP MySQL Webhosting

Profile
 
 
Posted: 26 June 2008 03:43 AM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  152
Joined  06-06-2007
Yash - 26 June 2008 03:34 AM

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

Else-> Research more…

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

Profile
 
 
Posted: 26 June 2008 03:53 AM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  375
Joined  10-22-2007

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.

 Signature 

Blogmer - Open source blogging software based on codeigniter
Blogmer Documentation
Web Design company and FREE PHP MySQL Webhosting

Profile
 
 
Posted: 26 June 2008 04:46 AM   [ Ignore ]   [ # 9 ]  
Summer Student
Total Posts:  14
Joined  06-26-2008

hi
i need to get “into” yor discussion because i got the same problem. Here’s my conf: ( Summer Student quotes:) )

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

Profile
 
 
Posted: 26 June 2008 04:51 AM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  152
Joined  06-06-2007

Also for Blue Sapphire:

hcvitto - 26 June 2008 04:46 AM

hi
Any idea about that?

You didn’t set rewritebase

Profile
 
 
Posted: 26 June 2008 04:52 AM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  375
Joined  10-22-2007

It looks you have done everything right.

I don’t xampp settings much.

Try WAMP server. Download latest version.It’s very easy to use and configure. or search for server settings in depth.

 Signature 

Blogmer - Open source blogging software based on codeigniter
Blogmer Documentation
Web Design company and FREE PHP MySQL Webhosting

Profile
 
 
Posted: 26 June 2008 04:53 AM   [ Ignore ]   [ # 12 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  152
Joined  06-06-2007
Yash - 26 June 2008 04:52 AM

It looks you have done everything right.

I think they didn’t set rewritebase correctly.


Try this

Blue Sapphire:
RewriteBase personal/dev/ci/

hcvitto:
RewriteBase CodeIgniter/

Hope this helps

Profile
 
 
Posted: 26 June 2008 04:56 AM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  375
Joined  10-22-2007

try playing with RewriteBase /  like RewriteBase CodeIgniter/ etc… Still I say go for simple

 Signature 

Blogmer - Open source blogging software based on codeigniter
Blogmer Documentation
Web Design company and FREE PHP MySQL Webhosting

Profile
 
 
Posted: 26 June 2008 04:58 AM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  375
Joined  10-22-2007

clooner is right…Try those

 Signature 

Blogmer - Open source blogging software based on codeigniter
Blogmer Documentation
Web Design company and FREE PHP MySQL Webhosting

Profile
 
 
Posted: 26 June 2008 05:23 AM   [ Ignore ]   [ # 15 ]  
Summer Student
Total Posts:  14
Joined  06-26-2008

i changed
RewriteBase CodeIgniter/

but now i got an error 500 on all pages..

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 77538 Total Logged-in Users: 36
Total Topics: 101541 Total Anonymous Users: 6
Total Replies: 544325 Total Guests: 243
Total Posts: 645866    
Members ( View Memberlist )