Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Filter by
Sorted by
Tagged with
0 votes
0 answers
65 views

Redirecting a url with urlManager in yii1.1

I'm trying to redirect the following url structure in Y1.1 /info/#/[string] to /site/info?value=[string] I tried 'urlManager'=>array( 'urlFormat'=>'path', 'showScriptName'=>...
Andrew Sparrow's user avatar
0 votes
1 answer
134 views

How to logically combine two controllers in yii2?

I have module named dashboard and PlanningController inside. The controller has become too big and I want to split it into several separate controllers. Now I have the following actions in ...
daniil sidorov's user avatar
0 votes
1 answer
278 views

How to rewrite categories url in htaccess or urlManager for yii2 classified ads website?

I am having issues with duplicated pages for seo , i think that the website when i make a categoy creates an original url then creates a duplicate of that url with the slug ,because i will find myself ...
David's user avatar
  • 1
0 votes
1 answer
699 views

yii2 url manager rules accept not pattern

I need configure my Yii2 UrlManager rules like this: change http://domain/site/action to http://domain/action change http://domain/module/default to http://domain/module so far what I have done: '...
Donny Akhmad Septa Utama's user avatar
3 votes
1 answer
90 views

Yii2 url manager parameter before controller

I have a site where I want a different experience for each state, and need the url to be related to the city. So instead of mysite.com/site/login it would be mysite.com/utah/site/login mysite.com/...
Andrew Sparrow's user avatar
1 vote
2 answers
1k views

How to configure the Yii2 UrlManager to handle rules with and without trailing slash

I have a page like domain.com/calendar/2001/8/22, it can be visited by domain.com/calendar/2001 domain.com/calendar/2001/8 domain.com/calendar/2001/8/22 It will show different content depending on ...
gowhere's user avatar
  • 21
0 votes
1 answer
442 views

Get Parameters Problems in Yii2

My question is that i will have the ? at the beginning of the get parameter's name.For example, if the url is https://example.com/path?id=2 I will get a get parameter named ?id.How can I get the id ...
da bei's user avatar
  • 1
-1 votes
1 answer
35 views

Extra slash in urlManager rules

I'm trying to map services/v2/ to servicesV2. I tried: 'services/v2' => 'servicesV2', And I tried: 'services/v2/' => 'servicesV2/', And: 'services/v2/<action:\w+>' => 'servicesV2/&...
Andrew Sparrow's user avatar
0 votes
1 answer
435 views

How to create custom urls with dashes in Yii2?

I am working with advanced project application and trying to add URL rules in Yii2 to handle custom URLs with dashes. What I want to do is to change the URL from http://www.example.com/post/details?...
Abdullah Tulek's user avatar
0 votes
1 answer
353 views

Yii 1.1 urlManager .php?param=<param> redirect

I'm having issues figuring out how to process some old URLs in Yii 1.1 that currently return 404. Below a small bit of the config file. 'urlManager' => array( 'class' => 'UrlManager',...
abreski's user avatar
  • 81
0 votes
1 answer
257 views

Yii2: slug not working

My PageController looks like: namespace app\controllers; use app\models\Page; use yii\base\Controller; use yii\web\NotFoundHttpException; class PageController extends Controller { public ...
BINAY THAPA MAGAR's user avatar
2 votes
1 answer
742 views

How to create clean url for Default page in Yii2 urlManager

My index rules like as below: [ 'pattern' => 'page/<page:\d+>', 'route' => 'site/index', ], it work, but in pagination, firest page is example/page/1, i change rules as below: [ ...
Masoud92m's user avatar
  • 622
-1 votes
1 answer
227 views

How to write rules in UrlManager Yii framework

All I want to remove this "menu-" from the URL: "example.com/menu-burger-king" Here is the code inside actionMenu $url=isset($_SERVER['REQUEST_URI'])?explode("/",$_SERVER['REQUEST_URI']):false; ...
Sami Khan's user avatar
-2 votes
1 answer
130 views

Yii2 UrlManager + wrong generate route

I have some problem - urlrules is correct but generated url from yii\bootstrap\Nav not correctly ->: {domain}/armory/search?server=Lorem+ipsum but this url working too -> {domain}/armory/search/Lorem+...
Qblolz's user avatar
  • 1
0 votes
1 answer
190 views

yii2 urlManager enablePrettyUrl not work with IndexController

My config: 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ '<alias:login|logout>' => 'site/<alias>', ], ] My ....
kestrel's user avatar
  • 33
-1 votes
1 answer
893 views

How to change change / to - in yii2 url for specific action

I'm rewriting wordpress site to yii2. and I have to keep previous posts urls for some reasons! They are somethings like that https://example.com/blog-thenameofpost So I created a Blog controller and ...
Manisa's user avatar
  • 11
0 votes
1 answer
39 views

Yii routing issue when use module

I want to use my url manager something link that.For my blog details http://example.com/yii-fremwork-install => it gose to blog controller details method where "yii-fremwork-install" is slug of ...
Md Hasibur Rahaman's user avatar
0 votes
1 answer
36 views

Setup urlManager in Yi2 to work like twitter

Ho can I set up urlManager patterns in a way that it works like twitter or any other social networks? for example I want to have the following routes: http://www.example.com/[user_id] http://www....
Hamid Ghorashi's user avatar
0 votes
1 answer
368 views

Remove controller and action from url yii

I want to hide controller and action name from url and only slug will show.E.g http://localhost/test-project/frontend/web/test-condition and "test-condition" is slug.I want to manage this from ...
Snigdhadeep's user avatar
2 votes
1 answer
1k views

Yii2 rest api - Url manager add parameters

I am working on an api that has 4 levels of users. Admin, reseller, channel and customer. All levels have call rates stored in respective _rate tables. Admin can view rates for all user levels, ...
Kyle's user avatar
  • 755
1 vote
1 answer
2k views

Yii2, optional parameter in the rounte

During the development, I have faced to the one issue with urlManager. I have SiteController with "category" action. public function actionCategory($id = null, $city = null, $location = null) { ...
Akmal Khikmatullaev's user avatar
2 votes
3 answers
5k views

Yii2: how to redirect old URLs with 301?

I have some URLs from the old version of my site that I want to redirect to their new ones in Yii2 due to SEO purposes, eg. /about-us.php to /about. How do I do that? I can't use .htaccess, and I can'...
TheStoryCoder's user avatar
0 votes
1 answer
521 views

yii2 - urlmanager and changing browser url

Is it possible with Yii2 change the browser url using the urlManager config? Or am I supposed to use only: Yii::$app->getResponse()->redirect(Url::to([...])); in the controller#action? ...
misterwolf's user avatar
-1 votes
2 answers
149 views

Yii2 url config not working

I'm using yii2 and i want url to be this way: example: backend.dev/ads/browse/city/london My code is this(backend/config/main.php): 'urlManager' => [ 'enablePrettyUrl' => true, ...
MHF's user avatar
  • 221
0 votes
1 answer
164 views

Yii2 - prevent access to specific files like controller

How can i prevent access to files like model or controller using yii options without writing a very big .htaccess
Thaier Alkhateeb's user avatar
1 vote
3 answers
2k views

Yii2 Trailing Slashes in URL is breaking the route

I configured UrlManager in a project and It was working the way I wanted. Now i tried to add a content whose name contains a trailing slash but i get an error 404 (Object not found). For example: ...
Francis Ngueukam's user avatar
1 vote
1 answer
537 views

How I add route rule from different controller or view or file by Urlmanager class in yii2

I want to add common url rules from a different files in YII2. How I array merge in return Urlmanager array. I study about this getUrlManager()->addRules but don't know I use it. '...
Destroyer.0211's user avatar
0 votes
0 answers
88 views

Yii2 urlmanager with many params

Now I have urlManager like this: 'art/list' => 'ask/index', 'art/list/sort/<sort:\w+>/' => 'ask/index', 'art/list/sort/<sort:\w+>/type/<type>' => 'ask/index', And have link:...
niksib's user avatar
  • 1
1 vote
2 answers
674 views

Yii2 does not create nice url - parameter

I use the URL manager in Yii2 to create nice urls, which works, as long as there are no parameters on the url. I set up the following config: urlManager' => [ 'enablePrettyUrl' => ...
The Bndr's user avatar
  • 13.4k
0 votes
2 answers
1k views

yii2 rest api url rewriting (hide directories)

I would like to use clean urls on my yii2 rest api. I'm having clean urls for my frontend application but I'm failing to create clean urls for my yii2 rest api application. I created the rest api by ...
brouckaertd's user avatar
0 votes
1 answer
161 views

Is there any way to trigger urlManager conditionally in YII framework

I have following code- 'urlManager'=>array( 'urlFormat'=>'path', //'showScriptName'=>false, //'caseSensitive'=>false, 'rules'=>...
Akshay's user avatar
  • 3
0 votes
0 answers
741 views

Pretty Url - Yii2 is not working

Using yii2 to develop web service. The results always return 404 not found if pretty url is enable. I suspect the htaccess or httpd.conf is not working. Expected route: http://localhost:63342/...
JohnnyCc's user avatar
  • 525
0 votes
0 answers
2k views

Yii Framework - Routing is not working

Coming from laravel background. Currently developing web service using yii framework but routing is not working as expected. This is the expected route to call web service. "api" is ApiController, "...
JohnnyCc's user avatar
  • 525
1 vote
1 answer
1k views

use blog name and id in url using yii2

I need to use blogname and id on the url on Yii2 like this is my url now :- http://localhost/html/demo/web/site/blog/blogdetail?id=39 I want to modify this link to :- http://localhost/html/demo/web/...
Mangita's user avatar
  • 605
1 vote
1 answer
757 views

Yii2 REST URL using slugs in place of id in view-slug method

I want to declare a method actionViewSlug($slug) in ScholarshipController in Yii2 REST api, My method is showing Not Found that too not in REST manner i.e. JSON. Here is my Url Config for ...
Harshit Chaudhary's user avatar
0 votes
2 answers
372 views

Yii2 class Yii/web/UrlManager causes error

I have urlManager like this in web.php 'urlManager' => [ //'class' => 'yii/web/UrlManager', 'enablePrettyUrl' => true, 'showScriptName' => false, ...
Mohammad Sulaiman's user avatar
1 vote
2 answers
2k views

Change/Rename Controller Name In URL: Yii2

I was looking to change controller name in URL. Which, we can do by renaming the controller name in module. But, Through URL manager if we can do it. It will be better. Module: user, Controller: api, ...
Nana Partykar's user avatar
0 votes
1 answer
506 views

yii2 routes double slash

I'm rewriting the back-end of a mobile APP and for retro-compatibility I need to serve URL like this one http://example.com/yii2app//sc4m/scPictureServlet/Pictures/clogo/5/ice2014.png/W/150 the ...
Alessandro Braccini's user avatar
0 votes
1 answer
69 views

How to use urlmanager yii2 with controller/detail?alias=abc-xyz

I have problem with alias on URL. .htaccess file RewriteEngine on # If a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # ...
Vo Tien Hung's user avatar
0 votes
1 answer
794 views

How to hide module name from url yii2

I am new to yii2. mydomain.com/organisation/banks/index from above url i want to remove organisation. i add following code to my config file under component section. 'urlManager' => [ '...
ros001's user avatar
  • 25
0 votes
2 answers
1k views

Receive 404 after uncomment enablePrettyUrl YII2

After uncomment enablePrettyUrl get 404 error For example: The requested URL /site/index was not found on this server. Apache/2.4.7 (Ubuntu) Server at yiibasic.com Port 80 When I comment it again, ...
wiaim's user avatar
  • 137
0 votes
3 answers
341 views

Making Custom Url in Yii 1.1.17

I am facing a problem in making custom URL using Yii framework. I need to make custom URL in the format like "category/product". The category URL slug and product URL slug comes from the database. ...
Jibran Musa's user avatar
0 votes
2 answers
272 views

YII2 UrlManager wrong route

On my site I have this urlManager rule: 'city/<id:\d+>-<alias:\S*>' => 'city/view', On page of module "user", for example this https://example.com/user/profile, there is a link for rule ...
Dmitry Ermichev's user avatar
0 votes
1 answer
103 views

Yii2 URL Management - issue in passing key-value pairs in URL

I am upgrading my website from Yii 1.1 to Yii2. In the older site using Yii 1.1, the url can be given as http://example.com/index.php/controller_name/action_name/queryString/123 But in Yii2 I have ...
user44028's user avatar
0 votes
1 answer
245 views

Yii2 how to hide module name in url?

I need some help with UrlManager in Yii2. I have blog application. There is module called 'blog'. There is BlogController with index action. To run it i must run url like this localhost/myblog/web/...
masteryoda's user avatar
2 votes
2 answers
2k views

Yii2 Rest URL Routing for Regular Controllers

How is it possible to extend yii\rest\UrlRule in a way I can rewrite rules for actions of a controller? For example, I want to generate the following URIs: /user/[username] /user/keywords /user/...
Hamid Ghorashi's user avatar
1 vote
2 answers
657 views

How to set urlmanager rule on multilanguage website in yii2?

We have multilanguage(ua, ru, en) website. And site language automatically inserts in url before any calling to controller/action. For example if language is 'ua' than request to site/index will be ...
user avatar
1 vote
1 answer
1k views

Yii 2. Replace "+" in URL to "-"

What do I want I want to replace "+" in URL-attrib to "-". I'm using Yii 2. I want working URLs with "-". URL::to(...) generates URL with "-". I want user to see in his browser address panel with "-...
D.R.'s user avatar
  • 2,938
0 votes
2 answers
419 views

Allow parsing file-like URL routes

Whenever I try and handle a route that looks like controller/foo.xtn, Yii complains Unable to determine the path info of the current request.. I want to handle these routes by converting xtn to an ...
user avatar
0 votes
1 answer
489 views

View article title on url instead of id in yii 1 web application for SEO pretty urls

i have articles in my yii web application, i want to view article title instead of id at the url, i have followed this link: http://www.yiiframework.com/forum/index.php/topic/43874-urlmanager-show-...
Jaber Abdallatef's user avatar

1
2 3 4 5