Skip to main content

Make SEO friendly URL in Yii

When you develop your website based on Yii PHP framework, you will need making it friendly for SEO purpose. You should make some simple changes to do this.
  1. Open config/web.php file. Find 'components' => [ and paste this codes below it:
    1. 'urlManager' => [
      'enablePrettyUrl' => true,
      'showScriptName' => false,
      ],
  2. Create .htaccess file on your root directory with below body:
    1. RewriteEngine on 
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . index.php 
Note: you can only use this feature when your server supports Rewrite URL fuction.
That's all. Wish succeed!

Comments

Popular posts from this blog

Turn off AutoPlay on Windows

On Windows, when you insert an USB or a CD/DVD into your computer, they are usually opened automatically. So the computer maybe infected autorun virus. To avoid that, you should turn off AutoPlay function.

Create Wordpress page template

When creating a new page in Wordpress, we usually have a choice for the page template. It's call Default template . However, we sometimes need to make a new page with a new appearance. Then another page template is needed. Instead of downloading a shared page template from internet, we can create a new page template by below instructions.