Welcome Guest, Not a member yet? Register   Sign In
.htaccess issue - Please Help
#1

[eluser]Blues Clues[/eluser]
I have the following .htaccess file in my installation and still not able to eliminate index.php in my links...


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.htaccess settings
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]*)$ ./index.php/$1 [QSA]
RewriteRule ^(.*)$ ./index.php/$1 [QSA]

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
config.php settings:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

$config['base_url'] = "http://localhost/codeigniter172/";
$config['index_page'] = "";


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Problem: I am still not able eliminate index.php in my URLs...For example:

http://localhost/codeigniter172/index.php/mainp/ loads my menu

but

http://localhost/codeigniter172/mainp/ fails with HTTP 404 error.

Can somebody help with this?
#2

[eluser]tomdelonge[/eluser]
Is mod rewrite enabled? I know you tell it to turn on in htaccess, but it has to be enabled on your php configuration. Did you do that yet?
#3

[eluser]Blues Clues[/eluser]
Yes, it is enabled...When I run PHPINFO.PHP on my local host...under loaded modules, I see

Loaded Modules:

core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_include mod_isapi mod_log_config mod_mime mod_negotiation
mod_rewrite
mod_setenvif mod_php5
#4

[eluser]tomdelonge[/eluser]
If you haven't already, check this article out:

http://codeigniter.com/wiki/mod_rewrite/

Also, I don't see a reason for all three lines:
Code:
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

I would just used the last two. They'll make it so that if a file exists, then it's given (for example if you have a /image/tree.jpg file, it will give it, but a request for /image/sun.jpg will be routed through the index.php file.

Just check out the article if you can.

Hope that helps.
#5

[eluser]Aken[/eluser]
Yes, you don't need the first RewriteCond if the other two are present.

Also, RewriteCond rules are only valid for the very first RewriteRule after them. Which, by the way, I don't know why it's there.

You should be able to get away with just the two REQUEST_FILENAME conditions, and then the second of your RewriteRules.

If you're still running into issues, try the different flavors of the uri_protocol config item.

More information: http://codeigniter.com/wiki/mod_rewrite/




Theme © iAndrew 2016 - Forum software by © MyBB