A
A
Almik Oh! Give me a guitar2014-12-05 08:54:13
Yii
Almik Oh! Give me a guitar, 2014-12-05 08:54:13

How to replace example.com/index.php/library with example.com/library?

Hello !
There is a site on yii 1.1 in which there are several modules
For example
example.com/index.php/library -- library
example.com/index.php/service -- something It is
necessary to be able to get to the places described above by shortened url
example. com/library -- library
example.com/service -- something
In general, how to remove Index.php? Website in yii, apache.
Tried directions from internet, doesn't work.
Thanks in advance,
Almik

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Frank, 2014-12-05
@Akellacom

Already discussed a hundred times. Learn
the materiel

'urlManager'=>array(
  'urlFormat'=>'path',
  'showScriptName'=>false,
  'rules'=>array(
    // стандартное правило для обработки '/' как 'site/index'
    '' => 'site/index',
    // это пример добавления который заработал
    //'secondcontroller/<action:.*>'=>'secondcontroller/<action>',
    'user/<action:.*>'=>'user/<action>',
    //'<action:.*>'=>'site/<action>', //закомментил а то глючило с ним
    '<controller:\w+>/<id:\d+>'=>'<controller>/view',
    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
  ),
),

.htaccess to root
Options Includes FollowSymLinks
#hide index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

ps check that mod_rewrite is enabled.

O
OnYourLips, 2014-12-05
@OnYourLips

The very first link in Google gives the answer: yiiframework.ru/forum/viewtopic.php?t=3264

A
Almik Oh! Give me a guitar, 2014-12-24
@almyk

1) From the beginning, look in the Apache settings to see if the AllowOverride All property is enabled
2) in the virtual host settings, add:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]

and it is necessary to check whether mod_rewrite is connected.
Plus as mentioned earlier by other people in yii settings i.e. in config/main.php:
urlManager'=>array(
  'urlFormat'=>'path',
  'showScriptName'=>false
  ...

And all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question