Welcome Guest, Not a member yet? Register   Sign In
Getting 404 errors trying to go to my home page
#1

[eluser]thorie[/eluser]
Hello,

I'm trying to hide "index.php" from my URLs. I followed the instructions on http://codeigniter.com/wiki/Dreamhost_.htaccess/

My CI site is located in a sub-folder on the domain so I replaced the /rbs/ part below accordingly:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /my_subfolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php
</IfModule>

Now when I access http://www.mydomain.com/my_subfolder I will get a 404 error.
I also tried http://www.mydomain.com/my_subfolder/index.php and I will also get a 404 error.

Can anyone help me with this? I know mod_rewrite works, because I have other CMS systems installed that are using it through .htaccess without a problem.

Thanks!
#2

[eluser]tomcode[/eluser]
Does Your site work without hiding - with the adequate config settings ?
#3

[eluser]thorie[/eluser]
Yeah, it works fine without the .htaccess file
#4

[eluser]thorie[/eluser]
I finally fixed it by adding a ? after the index.php on the RewriteRule with index.php/$1 [L]
#5

[eluser]tomcode[/eluser]
OK.

So change the .htaccess like this :

Code:
# <IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /my_subfolder/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]
  # </IfModule>

  # <IfModule !mod_rewrite.c>
  # If we don’t have mod_rewrite installed, all 404’s
  # can be sent to index.php, and everything works as normal.
  # Submitted by: ElliotHaughin

  #   ErrorDocument 404 /index.php
  # </IfModule>

On some servers this if clause does not work.

This should work or give You a 500 Error because mod_rewrite is not installed.

If You get the error 500, change / delete .htaccess, we don't want to stress Your server Smile

Just to make sure :
1. Your installation is in ./my_subfolder, ./ being Your public Web root
2. in ./my_subfolder/system/application/config/config.php :

Code:
$config['base_url']    = "http://www.mydomain.com/my_subfolder/";

$config['index_page'] = "";
#6

[eluser]tomcode[/eluser]
Oups, You've been faster ... good that it works for You now
#7

[eluser]thorie[/eluser]
Thank you very much for your help
#8

[eluser]coolgeek[/eluser]
[quote author="thorie" date="1250403450"]I finally fixed it by adding a ? after the index.php on the RewriteRule with index.php/$1 [L][/quote]

I just removed that '?' from my .htaccess on DreamHost as it was causing a translation of '.' to '_' in URI segments

see http://ellislab.com/forums/viewthread/47809/ for more info

my correctly functioning .htaccess:

Code:
DirectoryIndex index.php
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 [L,QSA]




Theme © iAndrew 2016 - Forum software by © MyBB