dongshi3818 2012-07-25 16:38
浏览 67
已采纳

如何在子文件夹中设置CodeIgniter htaccess?

I have setup a CodeIgniter Application on my server at the following URL:

http://subdomain.domainame.com/something1/something2/

(I have used something1 and something 2 as examples)

Now, I can access the application perfectly fine when using the above URL and can add /index.php/controller/action etc to the end.

I have tried to setup a .htaccess file in the same directory the application is hosted but it doesn't seem to be working.

The .htaccess file contains the following:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ something1/something2/index.php?/$1 [L]

This is giving me a 500 Internal Server Error.

Can anyone shed some light on this?

  • 写回答

1条回答 默认 最新

  • doudou348131346 2012-07-25 16:40
    关注

    I think I might have solved this.

    Changed:

    RewriteRule ^(.*)$ something1/something2/index.php?/$1 [L]
    

    To:

    RewriteRule ^(.*)$ /something1/something2/index.php?/$1 [L]
    

    I am no longer getting an internal server error.

    In order to assist anyone coming across this question, here is my full .htaccess file:

    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteRule ^(.*)$ /something1/something2/index.php?/$1 [L]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分