craftcms

How to create custom alias and where I should create it in craft?


Is there any way by which custom alias can be created in craft . I tried and found a way to make it by plugin but wanted to make it without a plugin


Solution

  • In your project's app.php file you can create your custom aliases. Add the below-given code to your return array in the app.php file. Also, you can change the name of the alias by replacing "@testUrl". For example:

    'aliases' => [
        '@testUrl' => 'http://samplewebsite.com',
    ], 
    

    I think this will help you.

    Thanks.