Skip to main content

tanya seputar url di ci

April 14, 2009 by yoyox

yoyox's picture

klu pake ci biasanya url seperti http://www.codeigniter-id.com/index.php/node/add/forum/4, nah klu misalkan url seperti ini ada yang tahu nggak, http://www.codeigniter-id.com/node/add/forum/4, bedanya index.php gak dipake gitu biar singkat. mohon pencerahannya

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

BLS:

May 11, 2009 by syabac, 2 years 38 weeks ago
Comment: 3557

syabac's picture

coba bikin file .htaccess pake editor/IDE kayak Notepad++, Netbeans..
isinya file tersebut bisa sperti ini..

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

Untuk IIS 7, menggunakan web.config.. tapi dengan module rewrite yang udah terinstall..
isinya kira2 seperti ini:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="rewrite">
<match url="^(.*)$" />
<action type="Rewrite" url="index.php/{R:0}" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

pake htaccess

April 17, 2009 by verisusan, 2 years 42 weeks ago
Comment: 2194

verisusan's picture

Kasih file .htaccess di root, isinya:

RewriteEngine on
RewriteCond $1 !^(index\.php|img|css|js\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Terus di config.php ubah jadi $config['index_page'] = "";

Rewrite Engine

April 14, 2009 by mul14, 2 years 42 weeks ago
Comment: 2189

mul14's picture

Mudah aja.. sebenernya di User Guide CI udah dikasi tau..
Tapi ini cuma berlaku kalo pake Web Server Apache.
Pertama buat file ".htaccess" (tanpa tanda kutip, tapi titiknya dipake).
Kalo pake OS Windows, buat aja dulu file htaccess. Trus masuk ke Command Prompt, ketik "ren htaccess .htaccess". Lalu edit dengan text-editor.

Masukkin ini didalam file tadi.

&lt;IfModule mod_rewrite.c&gt;
    RewriteEngine on
    RewriteBase /folder-anda/
    RewriteCond $1 !^(index\.php|images|robots\.txt|css|js|favicon\.ico)
    RewriteRule ^(.*)$ index.php/$1 [L]
&lt;/IfModule&gt;

Kalo udah, pastikan dulu rewrite engine sudah on di Apache..
Caranya buka httpd.conf, cari "LoadModule rewrite_module modules/mod_rewrite.so". Pastikan tidak ada tanda # didepannya.. Kalau diganti, restart Apache nya.

Pastikan juga pada application/config/config.php
$config['index_page'] = ""; sudah kosong..

Beress..

masih bingung nih

April 17, 2009 by yoyox, 2 years 42 weeks ago
Comment: 2193

yoyox's picture

iya, memang ada di user guide, tp gak tau langkahnya, klu buat file ".htaccess" di path/direktory mana, en nama file nya salah, gak bisa dibuat klu langsung extension .htacess, tolong ya bantuin lagi

Re: masih Bingung nih

May 3, 2009 by Anonymous, 2 years 39 weeks ago
Comment: 2630

Anonymous's picture

ketik di command prompt copy con .htaccess truz enter, setelah selesai tekan CTRL + Z

Premium Drupal Themes by Adaptivethemes