Yii Framework Forum: Url Manager - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Url Manager Setting path url Rate Topic: -----

#1 User is offline   __agus 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 166
  • Joined: 22-April 10
  • Location:Yogyakarta, Indonesia

Posted 06 September 2010 - 11:06 AM

Hi para master Yii,
Bagaimana agar url seperti
http://localhost/blog/index.php?r=site/page&view=about
dapat di setting sehingga menjadi
http://localhost/blog/about
.
Terima kasih.
0

#2 User is offline   elvan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 12-August 10

Posted 07 September 2010 - 01:59 AM

bikin file .htaccess di root folder projectnya,
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php


lalu tambahkan 'showScriptName' => false, ke config urlManager
'urlManager'=>array(
  'urlFormat'=>'path',
  'showScriptName' => false,
  'rules'=>array(
    '<controller:\w+>/<id:\d+>'=>'<controller>/view',
    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
  ),
),

0

#3 User is offline   __agus 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 166
  • Joined: 22-April 10
  • Location:Yogyakarta, Indonesia

Posted 17 September 2010 - 07:20 AM

udah bisa, aq dah tanya di Generals Topic

tinggal ditambahin ini:
'<view>' => array('site/page'),
0

#4 User is offline   __agus 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 166
  • Joined: 22-April 10
  • Location:Yogyakarta, Indonesia

Posted 17 September 2010 - 07:27 AM

Aku ada masalah lagi dengan UrlManager. Masalahnya ketika UrlManager diaktifkan, waktu dites dilocalhost jalan tetapi ketika diupload di internet selalu eror 404. Ada yang pernah mengalaminya g?. Padahal cuma script sederhana lho.

jadi aq buat satu controller dengan nama UserManagerController.php, dengan 2 action yaitu actionIndex dan actionView
path lengkapnya seperti ini:

/protected/controllers/UserManagerController.php
/protected/views/user_manager/index.php
/protected/views/user_manager/view.php

ini link diinternetnya:
http://jcross-indo.com/blog567

terima kasih
0

#5 User is offline   awik 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 16-December 08
  • Location:Yogyakarta

Posted 10 October 2010 - 02:25 AM

View Post__agus, on 17 September 2010 - 07:27 AM, said:

Aku ada masalah lagi dengan UrlManager. Masalahnya ketika UrlManager diaktifkan, waktu dites dilocalhost jalan tetapi ketika diupload di internet selalu eror 404. Ada yang pernah mengalaminya g?. Padahal cuma script sederhana lho.

jadi aq buat satu controller dengan nama UserManagerController.php, dengan 2 action yaitu actionIndex dan actionView
path lengkapnya seperti ini:

/protected/controllers/UserManagerController.php
/protected/views/user_manager/index.php
/protected/views/user_manager/view.php

ini link diinternetnya:
http://jcross-indo.com/blog567

terima kasih



wah gan..lagi nyari2 juga..gimana gan apakah sudah berhasil.....
jika udah share ya gan......
biar url ku juga bagus
0

#6 User is offline   isu_miring 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 25-October 10

Posted 25 October 2010 - 07:05 AM

View Postelvan, on 07 September 2010 - 01:59 AM, said:

bikin file .htaccess di root folder projectnya,
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php


lalu tambahkan 'showScriptName' => false, ke config urlManager
'urlManager'=>array(
  'urlFormat'=>'path',
  'showScriptName' => false,
  'rules'=>array(
    '<controller:\w+>/<id:\d+>'=>'<controller>/view',
    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
  ),
),



mw nanya...ini udah ditambahin dan jalan....tapi koq path yg ada di content nya berubah yah (contoh : <img src="images/file.jpg">, itu koq gambar nya jd ndak tampil yah...)?


thanks
0

#7 User is offline   YII alvs 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 11-February 10

Posted 25 October 2010 - 10:21 PM

View Post__agus, on 06 September 2010 - 11:06 AM, said:

Hi para master Yii,
Bagaimana agar url seperti
http://localhost/blog/index.php?r=site/page&view=about
dapat di setting sehingga menjadi
http://localhost/blog/about
.
Terima kasih.

baca ini lbih teliti bro url manager
0

#8 User is offline   fastcrash 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 245
  • Joined: 10-March 10
  • Location:South Jakarta

Posted 26 October 2010 - 01:48 AM

View Postisu_miring, on 25 October 2010 - 07:05 AM, said:

mw nanya...ini udah ditambahin dan jalan....tapi koq path yg ada di content nya berubah yah (contoh : <img src="images/file.jpg">, itu koq gambar nya jd ndak tampil yah...)?

thanks


klo ane lebih senang pake absolute path

<img src="'.Yii::app()->request->baseUrl.'/images/logout.png" />



ketimbang relatif path
<img src="/images/logout.png" />


soalnya itu dia klo di server suka lain lain..

klo boleh kasih tips sewaktu develop di localhot, buat pake virtual host,
<VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs/sidejob"
	ServerName sidejob.localhost
</VirtualHost>

jadi waktu di deploy(live) ga banyak yg aneh-aneh.. Posted Image
1

#9 User is offline   isu_miring 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 25-October 10

Posted 26 October 2010 - 02:37 AM

View Postfastcrash, on 26 October 2010 - 01:48 AM, said:

klo ane lebih senang pake absolute path

<img src="'.Yii::app()->request->baseUrl.'/images/logout.png" />



ketimbang relatif path
<img src="/images/logout.png" />


soalnya itu dia klo di server suka lain lain..

klo boleh kasih tips sewaktu develop di localhot, buat pake virtual host,
<VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs/sidejob"
	ServerName sidejob.localhost
</VirtualHost>

jadi waktu di deploy(live) ga banyak yg aneh-aneh.. Posted Image



iya sih...thanks ya...


<VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs/sidejob"
	ServerName sidejob.localhost
</VirtualHost>


itu naro nya dimana yah..??
maklum pemula...
0

#10 User is offline   fastcrash 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 245
  • Joined: 10-March 10
  • Location:South Jakarta

Posted 26 October 2010 - 10:33 PM

View Postisu_miring, on 26 October 2010 - 02:37 AM, said:

itu naro nya dimana yah..??
maklum pemula...


ane pake xampp (yg gampang aja boss Posted Image )
setelah install xampp:

Buka : D:\xampp\apache\conf\extra\httpd-vhosts.conf

tambahkan :
NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
	ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/sidejob"
	ServerName sidejob.localhost
</VirtualHost>

kemudian
Buka : C:\WINDOWS\system32\drivers\etc\hosts

tambahkan :
127.0.0.1       localhost
127.0.0.1       sidejob.localhost


restart apache..

tinggal di akses di browser..
http://sidejob.localhost


that is virtual hosts. Posted Image
1

#11 User is offline   isu_miring 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 25-October 10

Posted 28 October 2010 - 01:57 PM

View Postfastcrash, on 26 October 2010 - 10:33 PM, said:

ane pake xampp (yg gampang aja boss Posted Image )
setelah install xampp:

Buka : D:\xampp\apache\conf\extra\httpd-vhosts.conf

tambahkan :
NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
	ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/sidejob"
	ServerName sidejob.localhost
</VirtualHost>

kemudian
Buka : C:\WINDOWS\system32\drivers\etc\hosts

tambahkan :
127.0.0.1       localhost
127.0.0.1       sidejob.localhost


restart apache..

tinggal di akses di browser..
http://sidejob.localhost


that is virtual hosts. Posted Image


thanks yah...

tp koq kalo di local jalan. kenapa pas di server ndak jalan yah..??

ada yg bisa kasih tau..??

thanks
0

#12 User is offline   elviskudo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 13-July 10
  • Location:Malang Indonesia

Posted 29 October 2010 - 03:07 AM

mau post juga nih, ini juga ada problem, saya punya beberapa link:

1. front end:
http://localhost/_PROJECT/onlinestore/index.php?r=site/index

2. backend:
http://localhost/_PROJECT/onlinestore/index.php?r=admin/index


gimana caranya agar urlnya bagus dan secure:
1.
http://localhost/_PROJECT/onlinestore/

2.
http://localhost/_PROJECT/onlinestore/admin


soalnya kalo url:
http://localhost/_PROJECT/onlinestore/index.php?r=admin/index

mudah sekali ditembus misalnya pake:
http://localhost/_PROJECT/onlinestore/index.php?r=98745938745

maka tetap aja bisa tampil harusnya kan masuk ke error page

minta bantuan nih?
terima kasih ya?
0

#13 User is offline   YII alvs 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 11-February 10

Posted 31 October 2010 - 09:44 PM

View Postelviskudo, on 29 October 2010 - 03:07 AM, said:

mau post juga nih, ini juga ada problem, saya punya beberapa link:

1. front end:
http://localhost/_PROJECT/onlinestore/index.php?r=site/index

2. backend:
http://localhost/_PROJECT/onlinestore/index.php?r=admin/index


gimana caranya agar urlnya bagus dan secure:
1.
http://localhost/_PROJECT/onlinestore/

2.
http://localhost/_PROJECT/onlinestore/admin


soalnya kalo url:
http://localhost/_PROJECT/onlinestore/index.php?r=admin/index

mudah sekali ditembus misalnya pake:
http://localhost/_PROJECT/onlinestore/index.php?r=98745938745

maka tetap aja bisa tampil harusnya kan masuk ke error page

minta bantuan nih?
terima kasih ya?

coba deh lo downloand ex rights nya chris83
ext Rights

soalnya conf url
manager bisa dilihat seperti ini

 'urlManager'=>array(
        	'urlFormat'=>'path',
        	'rules'=>array(
        		'post/<id:\d+>/<title:.*?>'=>'post/view',
        		'posts/<tag:.*?>'=>'post/index',
        		'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

0

#14 User is offline   awik 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 16-December 08
  • Location:Yogyakarta

Posted 10 December 2010 - 10:30 PM

View Post__agus, on 17 September 2010 - 07:20 AM, said:

udah bisa, aq dah tanya di Generals Topic

tinggal ditambahin ini:
'<view>' => array('site/page'),



lebih detailnya gimana kang agus
aku lagi bingung2 nyari nyarinya nih
mohon penjelasan dan pencerahanya ya kang
TQ
0

#15 User is offline   cahmangir 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 10-December 10
  • Location:Yogyakarta Indonesia

Posted 10 December 2010 - 10:45 PM

lalu tambahkan 'showScriptName' => false, ke config urlManager
'urlManager'=>array(
  'urlFormat'=>'path',
  'showScriptName' => false,
  'rules'=>array(
    '<controller:\w+>/<id:\d+>'=>'<controller>/view',
    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
  ),
),



Lha naruh 'showScriptName' => false nya kemana ya?? hihi.....
Maaf, pemain baru...

Makasih..

Attached File(s)


0

#16 User is offline   fastcrash 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 245
  • Joined: 10-March 10
  • Location:South Jakarta

Posted 12 December 2010 - 11:30 PM

View Postcahmangir, on 10 December 2010 - 10:45 PM, said:

Lha naruh 'showScriptName' => false nya kemana ya?? hihi.....
Maaf, pemain baru...

Makasih..



di config/main.php di param urlmanager
'urlManager'=>array(
  'urlFormat'=>'path',
  'showScriptName' => false,
  'urlSuffix'=>'.html',  //fake extension, bisa juga .js, .mp3 watever lah..
  'rules'=>array(
    '<controller:\w+>/<id:\d+>'=>'<controller>/view',
    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
  ),
),

0

#17 User is offline   __agus 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 166
  • Joined: 22-April 10
  • Location:Yogyakarta, Indonesia

Posted 26 December 2010 - 12:05 PM

View Postisu_miring, on 28 October 2010 - 01:57 PM, said:

thanks yah...

tp koq kalo di local jalan. kenapa pas di server ndak jalan yah..??

ada yg bisa kasih tau..??

thanks


Yang jelas beda sistem operasi gan antara windows dan linux. selain itu setingannya juga beda:D.
Saya sendiri sudah dibuat bingung dengan hal itu:D
0

#18 User is offline   fastcrash 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 245
  • Joined: 10-March 10
  • Location:South Jakarta

Posted 27 December 2010 - 03:09 AM

View Post__agus, on 26 December 2010 - 12:05 PM, said:

Yang jelas beda sistem operasi gan antara windows dan linux. selain itu setingannya juga beda:D.
Saya sendiri sudah dibuat bingung dengan hal itu:D


betul gan, yang diatas buat 'virtual host jalan di windows'
klo mo buat 'virtual host jalan di linux', ane juga kurang tau gan.

mungkin bawah ane bisa ;D
0

#19 User is offline   __agus 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 166
  • Joined: 22-April 10
  • Location:Yogyakarta, Indonesia

Posted 28 December 2010 - 04:32 AM

View Postfastcrash, on 27 December 2010 - 03:09 AM, said:

mungkin bawah ane bisa ;D


Moga-moga aja;D

Mau nanya nih. Saya lihat di situnya pkpu.or.id url-nya bisa bagus. ada yang tahu g caranya?. makasih

kayak gini urlnya:
http://www.pkpu.or.id/news/suharjoni-sapujagat-evakuasi-mayat

0

#20 User is offline   Derian 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 25-December 10

Posted 28 December 2010 - 04:50 AM

mas mau nanya ni. kok saya gak bisa" yah masuk ke gii generate code ??
padahal smua udah dikonfigurasi dengan bnar.
saya memasukkan alamat gii sepert berikut :
1. http://localhost/bel...index.php?r=gii
2. http://localhost/belajar/index.php/gii

nah masalahnya :
-Jika saya masukkan alamat seperti no.1 maka muncul eror seperti berikut :

Error 404
Unable to resolve the request "gii".

-Jika saya masukkan alamat seperti no.2 maka yg muncul halaman home.

saya menggunakan windows xp2 apa da masalah ??
mohon mas pencerahannya karna saya bnar" ingin blajar yii :-(
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users