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条)

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法