CodeIgniter Forums

Full Version: htaccess made me insane!!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]ilpega[/eluser]
I have read a lot of topic with the same problem but i do not find the solution... please help me. I have a lamp into ubuntu server. My document root is /home/utente/ into this dir I have another dir (turni) with a codeigniter web app. The web app works fine with the "index.php" into the url, but I want to eliminate it. I have this configuration:

config.php into codeigniter:

Code:
$config['index_page'] = '';
.htaccess:

Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
/etc/apache2/sites-available/default:

Code:
<VirtualHost *:80>
    ServerAdmin [email protected]

    DocumentRoot /home/utente
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /home/utente/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
When i open a link of the web app with without eh "index.php" into the url, the server o me this error: The requested URL /turni/auth/login was not found on this server.

Why??? If i put the index.php like /turni/index.php/auth/login all works fine.... Thanks for help and sorry for my english Big Grin

El Forum

[eluser]Tpojka[/eluser]
Try with different RewriteBase in .htaccess file:

Code:
RewriteBase /turni/

El Forum

[eluser]ilpega[/eluser]
Thanks for response!

I tried the different rewritebase but nothing change Sad

I tried also, with RewriteBase /, to put che apllication into the root (/home/utente/) but nothing change... with index.php tha app works fine, without index.php ----&gt; The requested URL was not found on this server.

Any other solutions ???

El Forum

[eluser]Tpojka[/eluser]
Is $config['base_url'] variable set well?
I think it should be

Code:
$config['base_url'] = 'http://localhost/turni/';

And check error logs both CI and apache what is said.

El Forum

[eluser]CroNiX[/eluser]
probably not the problem, but you can remove these 4 lines as these directories now include their own htaccess which prevents direct access to them.

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]


But I think the problem is you are setting AllowOverride None