Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter URLs, .htaccess and all that stuff
#1

[eluser]mradlmaier[/eluser]
Hello,

I am a newbie and obviously this question is asked many times, but I could not find a clear explanation how to exclude the index.php in the URls.
Could anybody please post a HOW-TO with all steps involved, which answers questions like
- Do I have to delete the code-igniter-root/index.php
- Where exactly goes the .htaccess? In code-igniter-root/system/application/controllers/ or in code-igniter-root/ ?
- What exactly does .htaccess contain?
- To which values do have what variables have to be changed in code-igniter-root/system/config/config.php
- Any other things to do?
That is for apache2.2 on openSUSE 11.
I tried many things to no avail, I only get 403, 404, 500 Errors.
Access with the index.php included in the URL works, though.

Big thanks in advance,
Michael
#2

[eluser]bastones[/eluser]
The .htaccess file goes in the root folder (public_html/www/htdocs/ - whatever your root folder is), with the following:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

...then go into system/application/config and open up the config.php file and change the following line:

Code:
$config['index_page'] = "index.php";

to:

Code:
$config['index_page'] = "";

(yes, blank)

Then everything should work for you. If you still cannot access without index.php, reply and I'll give you another solution that may work Smile.
#3

[eluser]mradlmaier[/eluser]
Hello,

My exact configuration looks like this now

CodeIgniter is in /home/michi/ci with /home/michi/ci/.htaccess
/home/michi/ci is aliased as /ci/ in apache2, so I access this via http://127.0.0.1/ci/

I have the rewrite stuff exactly like you posted and the config file, too.

I get a 403 Error access is forbidden for http://127.0.0.1/ci/blog , http://127.0.0.1/ci/index.php and http://127.0.0.1/ci/index.php/blog

If I remove the .htaccess and change the config file back, everything works, but with the index,php included in the url.

:-S

Michael
#4

[eluser]bastones[/eluser]
[quote author="mradlmaier" date="1226335637"]Hello,

My exact configuration looks like this now

CodeIgniter is in /home/michi/ci with /home/michi/ci/.htaccess
/home/michi/ci is aliased as /ci/ in apache2, so I access this via http://127.0.0.1/ci/

I have the rewrite stuff exactly like you posted and the config file, too.

I get a 403 Error access is forbidden for http://127.0.0.1/ci/blog , http://127.0.0.1/ci/index.php and http://127.0.0.1/ci/index.php/blog

If I remove the .htaccess and change the config file back, everything works, but with the index,php included in the url.

:-S

Michael[/quote]

You need the htaccess to be in root (www) directory, not inside the CI directory. And if its a local machine on Windows; that's bound to happen. It happened to me - I got forbidden errors 'till I removed .htaccess, etc.
#5

[eluser]narkaT[/eluser]
try this Wink
#6

[eluser]mradlmaier[/eluser]
Hello,

O.K. narkaT,

including the option FollowSymlinks in the directory section fixed it for me (As described in the wiki) . And the .htaccess is in /home/michi/ci which translates to URL 127.0.0.1/ci (alias in apache).

Thanks,
Michael




Theme © iAndrew 2016 - Forum software by © MyBB