Welcome Guest, Not a member yet? Register   Sign In
HTACCESS PROBLEM TO REMOVE INDEX.PHP FILE
#1

[eluser]rafaelrp[/eluser]
Hello!

http://mysite.com/index.php/news works fine.
http://mysite.com/news doesn't work.

Configs:
Quote:mod_rewrite: on
Using Ubuntu 13.04

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

.htaccess file in root folder in project
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

By default CI puts .htaccess file in all folders and subfolders, i have to remove it?

The server just send me a 404 error..

Thanks!
#2

[eluser]yoelrodguez[/eluser]
Verify you have the site within a folder within public_html or have it in the root. if it is within a folder you have to put the name (/ name of the folder / index.php / $ 0 [PT, L])
#3

[eluser]rafaelrp[/eluser]
I have the application in a folder in the default folder of Apache (var/www/)
I Tried to put the folder in htaccess and nothing happens Sad

.htaccess:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|css|js|img|images|robots\.txt)
RewriteRule ^(.*)$ /ci-app/index.php/$1 [L]
#4

[eluser]yoelrodguez[/eluser]
as viewed in the apache log to see what error it gives
#5

[eluser]rafaelrp[/eluser]
Apache log
Code:
[Fri Sep 06 22:56:29 2013] [error] [client 127.0.0.1] File does not exist: /var/www/ci-app/news
#6

[eluser]Unknown[/eluser]
hello I use detailed form in my .htaccess

Code:
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .* index.php/$1 [PT,L]
#7

[eluser]Unknown[/eluser]
Olá, aqui meu padrão . htaccess.
Eu uso Windows 7 + Wamp.
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
#8

[eluser]CTheTech[/eluser]
I'm having a similar problem. You mention a .htaccess file in all these posts, but no one ever specifies where the file should go.
I think this may be leading to some confusion.

I have a .htaccess in controllers folder with index.php
"
Deny from all
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
"
Any help is appreciated
#9

[eluser]CroNiX[/eluser]
.htaccess should go in the same location as CI's index.php (your site's root dir). You should not alter the .htaccess located within /application or /system unless you understand the security implications (anyone could directly access your controllers/models/libraries/views/etc...so don't)

If your CI install is in a subdirectory, then you probably need to include a rewritebase statement.

Code:
RewriteEngine on
RewriteBase /your_ci_subfolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
#10

[eluser]rafaelrp[/eluser]
Yes!
It worked!

Code:
RewriteEngine on
RewriteBase /ci-app/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

Thanks!!

[quote author="CroNiX" date="1379614489"].htaccess should go in the same location as CI's index.php (your site's root dir). You should not alter the .htaccess located within /application or /system unless you understand the security implications (anyone could directly access your controllers/models/libraries/views/etc...so don't)

If your CI install is in a subdirectory, then you probably need to include a rewritebase statement.

Code:
RewriteEngine on
RewriteBase /your_ci_subfolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
[/quote]




Theme © iAndrew 2016 - Forum software by © MyBB