Welcome Guest, Not a member yet? Register   Sign In
.htaccess weird happenings!
#1

[eluser]brancher[/eluser]
hi

I have successfully removed index.php from my site. (viveiroarboreto.com.br)

But one thing is going very very weird: for all addresses of the site, everything is going fine, except for the arboreto controller: when pointing to viveiroarboreto.com.br/arboreto, it shows not arboreto but the default controller (welcome), like if I were pointing to the home page!

my htaccess file:

RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|public|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

and on config.php:

$config['base_url'] = "http://www.viveiroarboreto.com.br/";
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";

any clue?

thanks!

[edited: I think the problem is on htaccess because pointing to viveiroarboreto.com.br/index.php/arboreto, everything goes just fine!]
#2

[eluser]TheFuzzy0ne[/eluser]
Looks like the third line down is incorrect. Try this:

RewriteCond %{HTTP_REFERER} !^/(index\.php|public|robots\.txt)

or this:

RewriteCond %{HTTP_REFERER} !^(index\.php|public|robots\.txt)
#3

[eluser]Nevio[/eluser]
Code:
# Make index.php the directory index page
DirectoryIndex index.php

# CodeIgniter drop of "index.php"
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|public|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

# Block directory listings
Options -Indexes

This is the best I find out on web in my case well... Works on every platform correctly.
#4

[eluser]Daniel Moore[/eluser]
Nevio, your .htaccess is very good, but will not work on 100% of platforms. I have run across a rare quirk which will require the use of "Options -MultiViews" in some cases. Also, some hosts, like GoDaddy and a few others, require a "?" after index.php.

The following is my standard .htaccess which is easily adapted for use on all systems. I have yet to use it at a location where I could not get it to work.

This adaptation also gives me the option of placing a CI app in a subdirectory off the main root URL.

@brancher: I noticed you used the "index.php?" method in your .htaccess. Try it with and without the ? to see which works for you.

Code:
#  Code Igniter .htaccess file for the main index.php directory

#  If you must have your CI "system" directory at http://www.example.com/system,
#  Then I advise you to place a .htaccess file in that directory
#  with "deny from all" in it.

# Restore "allow from all" / I use a "deny from all" in some directory structures,
# especially where I am hosting multiple sub-domains that point to subdirectories
# of the main domain, this restores it.
allow from all

# Turn off directory listings for increased security
Options -Indexes

Options +FollowSymLinks
Options -MultiViews

# Make index.php the directory index page
DirectoryIndex index.php

# Turn on the RewriteEngine and set the base and condtions
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|public|img|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#  use the following line if CI is in the root of the URL.
#  You may need to use index.php/$1 or index.php?/$1
#  Try it with or without the ? after index.php to see which works for you.
#  GoDaddy accounts require the ?
#  My localhost with XAMPP on Windows also requires the ?
#  Most hosts work correctly without the ?, so try it without first unless
#  you know your host requires it.
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

#  use the following if CI is in a sub-directory, and place this
#  file IN that subdirectory.
#  Replace '<directory_name>' with the name of the sub-directory.
#  Use this if you have an application at
#  http://www.example.com/<directory_name>
#RewriteRule ^(.*)$ <directory_name>/index.php?/$1 [L,QSA]

I am always open to suggestions for improvement if anyone sees it.
#5

[eluser]brancher[/eluser]
nope... I have tried all options and no one got the job done. Things still working the same way... it redirects ok for all the site, except for viveiroarboreto.com.br/arboreto...

can the problem be in somewhere else? I thinks it`s htaccess because using /index.php/ things are working just fine...

tks
#6

[eluser]Nevio[/eluser]
@Daniel Moore hmm... Thanks.
#7

[eluser]Daniel Moore[/eluser]
[quote author="brancher" date="1238778523"]nope... I have tried all options and no one got the job done. Things still working the same way... it redirects ok for all the site, except for viveiroarboreto.com.br/arboreto...

can the problem be in somewhere else? I thinks it`s htaccess because using /index.php/ things are working just fine...

tks[/quote]

Open up your application/config.php and find the line that contains "$config['uri_protocol'] =". Check the value.

Try each of the values listed in the comment above it one at a time ('AUTO', 'PATH_INFO', 'QUERY_STRING', 'REQUEST_URI', and 'ORIG_PATH_INFO') and see if that fixes the problem.

Also make sure that config.php file has
Code:
$config['index_page'] = "";
#8

[eluser]brancher[/eluser]
Wow! You did it, boy! Setting it to AUTO got it done!

thanks!




Theme © iAndrew 2016 - Forum software by © MyBB