dongyun3805 2015-01-27 07:40 采纳率: 0%
浏览 12

Codeigniter网址处理

I am working with Codeigniter PHP project. I want the URLs changed to another format.

Current Format

http://localhost/en20/main/my_video/8/3

Expected Format

http://localhost/en20/my_video/dafaasdfw434sdafdsf

my current .htaccess file look like

RewriteEngine on
RewriteCond $1 !^(index\.php|images|system|asset|xsomo)
RewriteRule ^(.*)$ index.php?/$1 [L]

I just want to be unchanged the .htacces and if it can be done by routing.Please can anyone help me?

Thanks

  • 写回答

2条回答 默认 最新

  • drt96856 2015-01-27 07:46
    关注

    You can define js function for using site_url like,

    function site_url(path){
        path = typeof path !== 'undefined' ? path : '';
    
        if(window.location.host=='localhost' || window.location.host=='host_name')
        var site_url = (path != '') ? "http://"+window.location.host+"/project_name/index.php/"+path : "http://"+window.location.host+"/project_name/index.php";
        else
            var site_url = (path != '') ? window.location.protocol+'//'+window.location.host+'/index.php/'+path : window.location.protocol+'//'+window.location.host+'/index.php';
    
        return site_url;
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器