Nah langsung saja, bagaimana menghilangkan tulisan index.php yang selalu ada di URL code igniter, ikuti tutorial ini. Hemm sebenarnya gampang banget looo dan udah banyak yang share juga sih.
Caranya
- Buat file dengan nama .htaccess di www root Anda.
- Copi code dibawah ini pada file tersebut.<IfModule mod_rewrite.c> RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteEngine on RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
- Coba ketikkan url Anda di //localhost/NamaFolder/NamaController. Misalnya, untuk kasus tutorial saya sebelumnya, coba ketikkan url nya //localhost/mycodeigniter/con_mahasiswa
Dan Hasilnya,
Share this:
Like this:
Like Loading...
Related
- ci
- code igniter
- hapus
- index.php
- url
Terganggu dengan kata index.php di alamat web anda. ingin menghilangkan index.php, bagaimana cara menghilangkan inde.php. Caranya adalah simak cara berikut ini.
Agar index.php tidak di munculkan di alamat url web kita, caranya adalah dengan menambahakan file .htacces dengan isi kode script sebagai berikut.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
atau
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ – [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*)$ – [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
saya coba di code igniter berhasil. semoga bermanfaat . wassalam.
Share this:
Like this:
Like Loading...
Related
[updated March 2015] You will notice that this site which runs using WordPress that there is no index.php in the URL when you are directly addressing a page/post or when you are linking to other pages/posts. This can achieved using the following configuration.
There are two step 1’s, depending on whether you/your web provider is using Apache or Zeus scripting. To find out which server type are using (and loads of other information too, see Step 3 below).
Page Contents
Step 1: If your web server is using Zeus then:
Create a text file “rewrite.script” and add the content:
1
2
3
4
5
6
7
8
9
10
11
12
#Zeus webserver version of basic Wordpress mod_rewrite rules
map path into SCRATCH:path from %{URL}
look for file at %{SCRATCH:path}
if exists then goto END
look for dir at %{SCRATCH:path}
if exists then goto END
##### FIX FOR LOGIN/FORGOTTEN PASSWORD/ADMIN ETC #####
match URL into $ with ^/wp-.*$
if matched then goto END
##### FIX TO ALLOW SEARCH TO WORK #####
match URL into $ with ^/(.*)
set URL = /index.php/$1
to the file and place it in your “Web” directory (e.g., this is the naming format on Register365/Hosting365)
Step 1: If your web server is using Apache then:
As of 2014/15, most Register365 accounts now use Apache rather than Zeus. Modify your .htaccess file in the FTP root directory (i.e., the directory that you are placed in when you FRP to the site below “web”). It may already contain configuration information (that is the case for the first line below) and add the content between the # BEGIN WordPress and # END WordPress comments below:
1
2
3
4
5
6
7
8
9
AddHandler php56-script .php .php5
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Then upload the edited file it back to your FTP root directory. Remember that if you use the server tools to update the version of PHP that your account is using that you may have to make this change again.
Step 2: Changing your WordPress settings:
In the WordPress administrative interface, go into Settings->Permalinks and change the “Common Settings” to “Custom Structure” and enter:
1
http://derekmolloy.ie/%postname%/
or whatever other custom URL you are using. The important thing here is to remove the index.php from the URL.
Step 3. Finding out Server Information
The quickest way to find out detailed information about your server configuration is to create a script called info.php (or any_other_name.php) that contains the following line of code:
1
<!--?php phpinfo(); ?-->
FTP this file to your server web directory and then use your web browser to call the script e.g. www.derekmolloy.ie/info.php (this link will not work for security reasons!). When you call the URL you will get an output such as in the figure below:
Towards the bottom of this long page you will find “PHP Variables” and one of the entries is the SERVER_NAME, which is typically either Apache or Zeus. In Chrome just use Ctrl-F and search for SERVER_NAME.