Remove index.php on XAMPP apache server?
Update:
Ok I have removed the index.php reference from config in CI and it is not appearing in my url string anymore.
When I enter my base url it works fine and displays my home page:
http://localhost/midas/
However when I click on my links which take me to other pages I now get Object not found:
e.g. I click Blog button which takes me to:
http://localhost/midas/site/blog
Do I need to change my links as well now that index.php is removed?
Apache Error Log***
Terminating on signal SIGTERM(15)
[Tue Jul 12 11:14:31 2011] [warn] pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Tue Jul 12 11:14:31 2011] [notice] Digest: generating secret for digest authentication ...
[Tue Jul 12 11:14:31 2011] [notice] Digest开发者_开发知识库: done
[Tue Jul 12 11:14:33 2011] [notice] Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Tue Jul 12 11:14:33 2011] [notice] Server built: Oct 18 2010 01:58:12
[Tue Jul 12 11:14:33 2011] [notice] Parent: Created child process 3856
[Tue Jul 12 11:14:35 2011] [notice] Digest: generating secret for digest authentication ...
[Tue Jul 12 11:14:35 2011] [notice] Digest: done
[Tue Jul 12 11:14:36 2011] [notice] Child 3856: Child process is running
[Tue Jul 12 11:14:36 2011] [notice] Child 3856: Acquired the start mutex.
[Tue Jul 12 11:14:36 2011] [notice] Child 3856: Starting 150 worker threads.
[Tue Jul 12 11:14:36 2011] [notice] Child 3856: Starting thread to listen on port 443.
[Tue Jul 12 11:14:36 2011] [notice] Child 3856: Starting thread to listen on port 80.
[Tue Jul 12 13:02:00 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site, referer: http://localhost/midas/
[Tue Jul 12 13:02:09 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site, referer: http://localhost/midas/
[Tue Jul 12 13:02:24 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site, referer: http://localhost/midas/
[Tue Jul 12 13:02:34 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site, referer: http://localhost/midas/
[Tue Jul 12 13:03:53 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site, referer: http://localhost/midas/
[Tue Jul 12 13:03:56 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site, referer: http://localhost/midas/
[Tue Jul 12 13:04:52 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site, referer: http://localhost/midas/
[Tue Jul 12 13:06:13 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site
[Tue Jul 12 13:07:37 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site, referer: http://localhost/midas/
[Tue Jul 12 13:08:05 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site, referer: http://localhost/midas/
my htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [NC,R=301,L]
The -f and -d flags should be ignoring anything that isn't a file or directory... so it's possible that if /site/blog or whatever URL you're accessing actually exists in the request root, it's attempting to route the request there without using your rewrite rule.
It'd be helpful to know the behavior you're actually seeing when you try this configuration, though.
Try this
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [NC,R=301,L]
Is there a particular reason you are using the redirect rule (R=301)
?
If you remove that portion of the rule so you get [NC,L]
instead then you preserve the hiding of the url.
I've tried your rules on my Wamp Server installation and it works fine on mine, are you positive that the mod_rewrite is firing for you?
精彩评论