Carian

Items filtered by date: February 2011
Wednesday, 16 February 2011 19:47

Codeigniter – remove index.php (mod rewrite)

Kepada yang biasa dengan codeigniter, Tentu sekali ingin menampakkan aplikasi mereka lebih profesional atau menjadikan aplikasi Search Engine Friendly (SEO).

URL lalai pada codeigniter :
http://localhost/mykid/index.php/objek/method

Anda boleh tukar URL kepada :
http://localhost/mykid/objek/method

Perkara tersebut mudah dengan beberapa langkah.

1. Buka fail config.php.
2. Cari baris -> $config['index_page'] = “index.php” dan tukar kepada $config['index_page'] = “”.
3. Jangan lupa save.
4. Buat satu fail .htaccess pada folder codeigniter.
5. Isikan fail .htaccess dengan kod di bawah ;
------------------------------

<ifmodule mod_rewrite.c="">
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
</ifmodule>
<ifmodule !mod_rewrite.c="">
ErrorDocument 404 /index.php
</ifmodule>

------------------------------
6. Dan jangan lupa enable mod_rewrite pada apache.
7. Restart apache.

Itu sahaja.

Dan anda juga boleh menjadikan URL anda seperti berikut ;
1. http://localhost/mykid/objek/method.html atau
2. http://localhost/mykid/objek/method.asp atau
3. http://localhost/mykid/objek/method.rais

Anda cuma perlu ubah fail config.php dan cari baris $config['url_suffix'] = “” dan tukar kepada $config['url_suffix'] = “.html” atau $config['url_suffix'] = “.asp” atau $config['url_suffix'] = “.rais”.

Mungkin mereka tertanya-tanya, apakah programming yang anda gunakan untuk sistem anda.

 

Sumber : rais.my

Published in Blog

This is the procedure in installing oci8 support to a CentOS 5.5 x86_64 assuming you are already have Apache and PHP installed beforehand.

1. Download oracle instant client (basic and devel) from :

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html

2. Install the basic and development package.

[root@ptm ] rpm -Uvh oracle-instantclient-basic-<VERSION>.x86_64.rpm
[root@ptm ] rpm -Uvh oracle-instantclient-devel-<VERSION>.x86_64.rpm

3. Link the installation dynamically

[root@ptm ] echo /usr/include/oracle/<VERSION>/client/lib/ > /etc/ld.so.conf.d/oracle_client.conf
[root@ptm ] ldconfig -v

4. Download oci8 package  from :

http://pecl.php.net/package/oci8

5. Extract and install the package

[root@ptm oci8-1.4.5] phpize
[root@ptm oci8-1.4.5] ../configure -with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client64/lib/
[root@ptm oci8-1.4.5] make
[root@ptm oci8-1.4.5] make install

6.  Add the library shared object for PHP

[root@ptm oci8-1.4.5] echo extension=oci8.so > /etc/php.d/oci8.ini

7. restart Apache

8. In phpinfo should now see that oci8 support is now enabled.

Note : This instruction is adapted from :

http://bigjim-network.be/2009/06/02/oracle-from-php-on-centos-5/


Published in Blog
You are here