A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 113

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 280

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::read($session_id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 145

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::write($session_id, $session_data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 223

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::destroy($session_id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 303

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 344

A PHP Error was encountered

Severity: 8192

Message: setcookie(): Passing null to parameter #7 ($httponly) of type bool is deprecated

Filename: core/Input.php

Line Number: 410

Codeigniter Adresten index.php Kaldırma
Öneri ve Hata Raporu



Günün Sözü Sevemez kimse seni benim sevdiğim kadar

oylama 3/5 yorum 0 yorum yazar Hakan Taşan tarih 01 Ekim 2013

Bu makalede Codeigniter URL yapısından index.php yazısını kaldırmayı öğreneceğiz. Bazı arkadaşlar daha düzenli görünüm için bu yazıyı kaldırmak isteyebilirler, ayrıca SEO açısındanda bu yazıyı kaldırmak bize avantaj sağlayacaktır. İşlemleri anlatmadan önce Codeigniter'ın URL yapısına bakalım;

benimsitem.com/class(controller)/function/ID

 

Codeigniter'da şöyle bir adresimiz olduğunu varsayalım;

benimsitem.com/index.php/oyunlar(controller)/oyunadi(function)/maxpayne

 

Şimdi bu adresten index.php yazısını silmeye geçelim.

Gerekli Dosyalar

index.php yazısını kaldırmak için bize .htaccess ve Codeigniter'ın config.php (application/config/config.php) dosyaları gereklidir.

1) Eğer .htaccess dosyanız yoksa kök dizine bir tane .htaccess dosyası oluşturun (Kök dizin: application, system vb. dosyaların olduğu yer).

Dosyanın içine şu kodları kopyalayın;

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt) 
RewriteRule ^(.*)$ /index.php/$1 [L]

 

2) Codeigniter'ın config.php (application/config/config.php) dosyasını açın.

a) $config['index_page'] = 'index.php'; değerini $config['index_page'] = ''; olarak değiştirin.

b) $config['uri_protocol'] = 'AUTO'; değerini $config['uri_protocol'] = 'REQUEST_URI'; olarak değiştirin.

$config['index_page']       = '';

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

 

Yapmanız gereken tüm işlemler bu kadar. Eğer doğru bir şekilde yaptıysak artık sitemize şu adresten girebiliriz demektir.

benimsitem.com/oyunlar/oyunadi/maxpayne

 

paylaş Paylaş
oylama yap Oyla

makale yorumları YORUMLAR

Bu makale için yorum yazılmamış