Welcome Guest, Not a member yet? Register   Sign In
Removing index.php in Codeigniter
#21

[eluser]drewdin[/eluser]
I did, it is still commented out. On my mac this fails at the home page. On windows the home page still works but the links fail.

Is there a recommended uri_protocol? Right now I have it set to AUTO.

This is driving me nuts!
#22

[eluser]TheFuzzy0ne[/eluser]
OK, please insert a space in the RewriteBase directive:
Code:
Rewrite Base /

That should cause an error when you access your Web site if mod_rewrite is enabled. I just want to be sure.
#23

[eluser]drewdin[/eluser]
I have it set to
Code:
RewriteBase /
and it still fails when I click on the link. For reference, here is my link just in case that the error.
Code:
<a href='about'>About</a>

Also, the .htaccess file is located in the root folder with applications and others. SHould there be two .htaccess files or just one in the root? Thanks for the help
#24

[eluser]TheFuzzy0ne[/eluser]
Your links should be absolute:
Code:
<a href="&lt;?php echo site_url('about'); ?&gt;">About</a>

So that's definitely part of the problem, but I need you to type http://localhost/CodeIgniter/about directly into your browser's address bar to test it.

Please backup your current .htaccess file and try this one:
Code:
RewriteRule ^(.*)$ /index.php?/$1 [L]

You will need to alternate through the different URI protocols, and try to access your site using http://localhost/CodeIgniter/about.

If that doesn't work, try this instead - this looks the same as the previous one, but there's one tiny difference:
Code:
RewriteRule ^(.*)$ index.php?$1 [L]

and cycle through the URI protocols again, testing as before.

Hopefully one of those should do the trick. If it does, please let me know, and I'll provide you with a better .htaccess file as the ones above are just for testing purposes.
#25

[eluser]drewdin[/eluser]
When I changed my Links to the ones you specified, i got the following error.
Code:
( ! ) Fatal error: Call to undefined function site_url()

I have three RewriteRule's, One for Core, one for application and one at the bottom of the file. Do I modify all three? Thanks
#26

[eluser]TheFuzzy0ne[/eluser]
Yes, sorry, that's part of the URL helper. You'll need to load it before using it. I use it in a lot of my views, so I have it in ./application/config/autoload.php

Yes, you would need to modify all three, sorry for not being clear on that.
#27

[eluser]drewdin[/eluser]
Thanks for the clarification, i enabled the url helper and still got the error when i browsed to the page.

Code:
Not Found

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

after I made the change to the Rewrite rules
Code:
RewriteRule ^(.*)$ index.php?$1 [L]
, along with the
Code:
uri_protocol = "QUERY_STRING"
i now get this error


Code:
404 Page Not Found

The page you requested was not found.

All other uri_protocol just stayed at the main index page and woudl not navigate when i clicked the links.

I appreciate your help!

#28

[eluser]TheFuzzy0ne[/eluser]
Aha! It looks like it's CodeIgniter that's responding when you set your URI protocol to QUERY_STRING, rather than the Web server. Now we just need to figure out how to fix the .htaccess file.

Please try this as your new .htaccess file (completely replace the old one):
Code:
RewriteEngine On
RewriteBase /CodeIgniter/
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

If that doesn't work, please could you post a dump of the $_SERVER super global?
Code:
die('<pre>' . print_r($_SERVER, TRUE) . '</pre>');
#29

[eluser]drewdin[/eluser]
I am at work trying to get this working using my windows system, when i get home from work Ill be working back on my MAC. Either way I cant get anything going.

I modified my .htaccess file and it still didn't work. here is the output of server.

Code:
[HTTP_HOST] => localhost
    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; rv:20.0) Gecko/20100101 Firefox/20.0
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [HTTP_DNT] => 1
    [HTTP_REFERER] => http://localhost/
    [HTTP_CONNECTION] => keep-alive
    [PATH] => C:\Python33\;C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\QuickTime\QTSystem\;c:\Program Files\Common Files\Adobe\AGL;C:\FFmpeg\bin;
    [SystemRoot] => C:\Windows
    [COMSPEC] => C:\Windows\system32\cmd.exe
    [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    [WINDIR] => C:\Windows
    [SERVER_SIGNATURE] =>
    [SERVER_SOFTWARE] => Apache/2.2.22 (Win32) PHP/5.4.3
    [SERVER_NAME] => localhost
    [SERVER_ADDR] => 127.0.0.1
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => 127.0.0.1
    [DOCUMENT_ROOT] => C:/Users/me/Dropbox/www/
    [SERVER_ADMIN] => admin@localhost
    [SCRIPT_FILENAME] => C:/Users/me/Dropbox/www/CodeIgniter/index.php
    [REMOTE_PORT] => 58724
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] =>
    [REQUEST_URI] => /CodeIgniter/
    [SCRIPT_NAME] => /CodeIgniter/index.php
    [PHP_SELF] => /CodeIgniter/index.php
    [REQUEST_TIME_FLOAT] => 1366137789.861
    [REQUEST_TIME] => 1366137789
#30

[eluser]TheFuzzy0ne[/eluser]
At which point did you switch to a Windows machine? I was under the assumption that we were working on a Mac.




Theme © iAndrew 2016 - Forum software by © MyBB