dtz30833 2013-04-10 09:55
浏览 45

如何在codeigniter 1.7.2的url中跳过index.php和方法名?

I am newbie with Codeigniter 1.7.2. I want to skip index.php and method name of Site URL. But I don't know how to skip them. My site url looks like -

http://localhost/mysadagi_voicetongues/index.php/deal_bazaar/PrivilegeDealsbazaar

So I want skip index.php and PrivilegeDealsbazaar from url.

Please give solution to fix this issue.

Thanks

  • 写回答

3条回答 默认 最新

  • doubianyu7844 2013-04-10 10:00
    关注

    I forget to tell. open your config file: application/config/config.php and change this line

    $config['index_page'] = “index.php”
    

    To

    $config['index_page'] = “”
    

    Create a .htaccess file in the root of your app so

    • system
    • application
    • assets
    • .htaccess

    To delete the index.php from your url use this .htaccess file:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ index.php?/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^LoginTut.*
    RewriteRule ^(.*)$ index.php?/$1 [L]
    
    RewriteCond $1 !^(index\.php|images|table-images|js|robots\.txt|css|captcha)
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?$1 [L]
    </IfModule>
    <IfModule !mod_rewrite.c>
     ErrorDocument 404 index.php
    </IfModule>
    

    It's not a very good idea to hide the controller name because you will get a lot of problems when routing and linking to other functions.

    Hope it helps!

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料