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

[eluser]jupiter1031[/eluser]
I am unable to bypass index.php. I have used various .htaccess variations but no luck.
I am using a standard setup, application directory is directly in root directory, style.scc is directly in root directory, so is the images directory.
I am hosting on fatcow.com, using php5.
What do I need to look for in order for it to work? I have read various forum entries and the help files. I am not experienced in server configurations.
My first question is: I assume the .httacces file needs to be only in the root directory?
#2

[eluser]Gerep[/eluser]
Hi jupiter.

Yes, the file must be only in the root.

You have to change the following line on your file:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /your_site

to

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

And remember to take the index.php value from config.php #29
Code:
$config['index_page'] = '';
and also
Code:
$config['base_url']    = 'http://www.your_site.com';

Hope it helps
#3

[eluser]jupiter1031[/eluser]
I did what you suggested, but it did not work. Don't I have to tell the server to include index.php?
#4

[eluser]Gerep[/eluser]
Jupiter, I use this htacces and it is working fine.

Are you running your code on a Windows server?
#5

[eluser]jupiter1031[/eluser]
I am not a server expert but I just saw it is a Debian platform. I have fatcow.com hosting. Since no .httaccess version worked, I suspect there must be a server setting that does not allow this feature. Any idea what to look for?
#6

[eluser]InsiteFX[/eluser]
The file has to be in the root directory with index.php
Code:
<IfModule mod_rewrite.c>

    AddDefaultCharset UTF-8
    AddHandler application/x-httpd-php5 .php

    # cache images and flash content for one month
    <FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$">
        Header set Cache-Control "max-age=2592000"
    </FilesMatch>

    # cache text, css, and javascript files for one week
    <FilesMatch ".(js|css|pdf|txt)$">
        Header set Cache-Control "max-age=604800"
    </FilesMatch>

    # deny directory browsing
    IndexIgnore */*

    Options +FollowSymLinks
    RewriteEngine on

    # NOTICE: If you get a 404 play with combinations of the following commented out lines
    AllowOverride All
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^/system.*
    #RewriteRule ^(.*)$ /index.php?/$1 [L]

    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^/application.*
    #RewriteRule ^(.*)$ /index.php?/$1 [L]

    # Restrict your site to only one domain. Change to your website!
    #RewriteCond %{HTTP_HOST} !^example\.com$
    #RewriteRule ^(.*)$ http://example.com/$1 [L]

    RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)

    # Send request via index.php (again, not if its a real file or folder)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    <IfModule mod_php5.c>
        RewriteRule ^(.*)$ index.php/$1 [QSA,L]
    </IfModule>

    <IfModule !mod_php5.c>
        RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
    </IfModule>

    ErrorDocument 404 index.php

</IfModule>

InsiteFX
#7

[eluser]jupiter1031[/eluser]
Thank You for this detailled and commented .htaccess file. I still have not figured out how to get it to work on my end. Do you have any experience of how to best appoach this. Is anzbody else out there with similar experiences?
Thanks to all of you for your support!




Theme © iAndrew 2016 - Forum software by © MyBB