CodeIgniter Forums
Problem removing index.php from url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem removing index.php from url (/showthread.php?tid=22663)

Pages: 1 2


Problem removing index.php from url - El Forum - 09-17-2009

[eluser]Ram2810[/eluser]
i installed mod_rewrite

.htaccess code is as follows

Code:
RewriteEngine On
RewriteCond $1 !^(index\.php|assets|css|images|js|javascript|robots\.txt|favicon\.ico|license.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

removed index.php from config

I have my project in my local htdocs folder with the same heirarchy a index.php file of wamp server is present.
Inside my project folder i am having projects index.php file

By doing all the above i said when i type url without index.php it is being redirected to wamp severs index .php file ........ this is not working pls do help me out


Problem removing index.php from url - El Forum - 09-17-2009

[eluser]rogierb[/eluser]
Try:

<code>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</code>

Or change the RewriteBase to /projects/


Problem removing index.php from url - El Forum - 09-17-2009

[eluser]Nick Husher[/eluser]
[quote author="wiredesignz" date="1253210934"]Server 500 errors indicate mod_rewrite is not installed.[/quote]

Not necessarily true. Disallowed .htaccess directives can trigger a 500 error. Running the pre-installed OS X Apache server, I had to specifically allow overrides for my home directory. I have this in my httpd configs:

Code:
<Directory "/Users/nhusher/Sites/">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>



Problem removing index.php from url - El Forum - 09-17-2009

[eluser]Ram2810[/eluser]
Thank you
rogierb

for your .htaccess suggestion it did worked ........ i dont know how this will when i move project files to main server ......... i am still not able to understand .htaccess file can any one suggest me tutorials or notes for knowing .htaccess and directory writing better so that i can go on my own next time around....

thank you


Problem removing index.php from url - El Forum - 09-17-2009

[eluser]bretticus[/eluser]
[quote author="Ram2810" date="1253216169"] i am still not able to understand .htaccess file can any one suggest me tutorials or notes for knowing[/quote]

.htaccess is just a file you put in a given folder to modify the apache config for just that folder (it is better to modify the apache config but most often you do not have access to it.)

mod_rewrite is a module that is commonly included in apache installs to alter or rewrite the url that was submitted (in your case you needed http://localhost/lotus_ci/{anything} rewritten to http://localhost/lotus_ci/index.php/{anything}.

Here's an in-depth tutorial covering mod_rewrite for apache.


Problem removing index.php from url - El Forum - 09-17-2009

[eluser]Nick Husher[/eluser]
Not to be too intimidating, but htaccess files are considered one of the major pieces of "black magic" in Apache. There are plenty of tutorials online for getting basic stuff done, but the masters of the htaccess are all gaunt old men clad in dark flowing robes that spend their days deep in the server catacombs. They learned their mastery the hard way: trial and error. Most of them also know how to write a sendmail.cf from scratch.


Problem removing index.php from url - El Forum - 09-17-2009

[eluser]Ram2810[/eluser]
Now there is new problem menu links to other pages are not working on remote server.

following is the error for a url .... http://lotustravelsindia.com/test/lotus_ci/home

Code:
Not Found

The requested URL /lotus_ci/index.php/home was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at lotustravelsindia.com Port 80



Problem removing index.php from url - El Forum - 09-22-2009

[eluser]saidbakr[/eluser]
I have the same problem too!