dpy3846 2015-01-19 20:30
浏览 20
已采纳

在url,codeigniter,seo中使用utf 8

im building a website and i want to use utf 8 characters in the url ive looked in some places but i didnt got the answer i need so i have few questions about it.

im using codeigniter and the website im building have a articles i want to send the article title (not in english) in the url

domain.com/ctrl/articles/articleTitle(not in english)

  1. is it or is it not good for SEO to use this kinds of urls in case my visitors gone a search not in english
  2. how do i do it?

thank you all for your answers.

  • 写回答

2条回答 默认 最新

  • dsa89029 2015-01-19 21:20
    关注

    if you put this line in your controller constructor it forces everything to be utf-8

    class Article extends CI_Controller {
    
      function __construct() {
    
        parent::__construct();
    
        // set all to utf-8 
        $this->output->set_header('Content-Type: text/html; charset=utf-8');
    
      } 
    
    // controller methods etc 
    

    the links will be output in your view files -- this insures that all your text including links will be output in utf-8 encoding. the other side of this is characters that are not allowed in the url by default by codeigniter -- in application/config/config.php check out

    $config['permitted_uri_chars']
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序