webnevesht
پنج شنبه 23 بهمن 1393, 12:39 عصر
سلام. من از محیط ویندوز و Xampp استفاده میکنم برای انجام دادن پروژه هام.
شروع کردم با Yii2 نسخه Basic کار کنم.
فرض کنین آدرس پروژه من در لوکال اینه:
http://localhost/yiiproject/web/
و کانفیگ urlManager از فایل کانفیگ Yii هم اینه:
'urlManager' => [
'class' => 'yii\web\UrlManager',
// Disable index.php
'showScriptName' => false,
// Disable r= routes
'enablePrettyUrl' => true,
'rules' => [
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
],
],
و همینطور فایل .htaccess من هم اینه:
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
ممنون میشم راهنمایی کنین که چطوری میتونم عبارت web رو از توی آدرسم بردارم.
که آدرسم به این شکل تبدیل بشه:
http://localhost/yiiproject/controllername/actionName
شروع کردم با Yii2 نسخه Basic کار کنم.
فرض کنین آدرس پروژه من در لوکال اینه:
http://localhost/yiiproject/web/
و کانفیگ urlManager از فایل کانفیگ Yii هم اینه:
'urlManager' => [
'class' => 'yii\web\UrlManager',
// Disable index.php
'showScriptName' => false,
// Disable r= routes
'enablePrettyUrl' => true,
'rules' => [
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
],
],
و همینطور فایل .htaccess من هم اینه:
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
ممنون میشم راهنمایی کنین که چطوری میتونم عبارت web رو از توی آدرسم بردارم.
که آدرسم به این شکل تبدیل بشه:
http://localhost/yiiproject/controllername/actionName