问题标签 [codeigniter-url]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
2932 浏览

codeigniter - 如何限制对我的文件夹的访问

我正在使用 codeigniter 构建一个包含大量图片库的网站,我将图片存储在文件夹中,但我想限制通过 url 访问文件夹。即我不希望人们使用 url 访问我的图片文件夹像这样::

http://网站/all_images/

所有图像都是包含图像文件夹的文件夹..我尝试使用htaccess文件

index.php 的重写条件运行良好,但我仍然可以通过 url 访问我的所有文件夹

0 投票
2 回答
15967 浏览

.htaccess - Codeigniter .htaccess

Sorry for my bad english...

I have the most basic possible CodeIgniter setup and can't make it work... if i access the url http://domain.com/index.php?controllerX/method it works fine.

Now I want to be able to access http://domain.com/method

I configured on routes.php "controllerX" to be the default controller and try to use the follow .htaccess:

I have tried multiple .htaccess and everytime the server just returns 403 errors. Even if my .htaccess contains only the first line "RewriteEngine on", it shows 403 errors. I have tried to set every folder to chmod 777 or 755 to test and this change nothing.

Is there a way to see what resource are giving the 403 error? Or am I comiting a mistake elsewhere?

Ok, i readed somewhere that I need "Options +FollowSymLink" on my htaccess ... with that the server show me 500 errors :(

EDIT Ok, now its working, with the follow htaccess:

0 投票
2 回答
319 浏览

javascript - jQuery 在 codeigniter 中查找 URI

我有一个在我的 codeigniter 站点的每个页面上运行的脚本。

setTimeout('changeImage()',9000);如果我在基本 url 上并且 URI 中没有段(只希望它在我的主页上运行),我只想要最后一行。

这是否可以if使用 jQuery 执行某种类型的语句并找出 URI 中是否没有段?

谢谢

0 投票
1 回答
1889 浏览

codeigniter - 代码点火器 404_override

我已经设置了 $routes['404_override'] = 'city/switch_site'

现在在我的城市控制器

城市类扩展 CI_Controller {

我现在如何将正确的 url 传递给 codeigniter 路由器

0 投票
2 回答
3048 浏览

api - CodeIgniter 中正确的自定义 API 版本控制

我已经建立了一个提供 API 的 CodeIgniter 2.0 站点。我现在需要创建另一个版本的 API,它不会与以前的版本向后兼容。这是我正在尝试做的事情:

  1. 创建版本化的 API 控制器,例如 {root}/application/controllers/api/v1.0/api.php 和 /v2.0/api.php 等...
  2. 允许更高的 API 版本从以前的版本继承,所以我只需要覆盖那些我想要的方法

CodeIgniter 似乎不喜欢这种类型的文件夹结构。而且,如果我所有的 API 控制器都具有相同的类名,我将无法进行子类化(即“类 API 扩展 API”将不起作用)。也就是说,我宁愿不必这样做:“类 API2_0 扩展 API1_0”,但如有必要,我会这样做。

我觉得 URI 路由将是这里的关键(我对它的理解有限),但如果有人已经经历过这个思考过程,我将非常感谢一些指导。谢谢!!!

-史蒂夫

0 投票
1 回答
87 浏览

security - 为什么在配置文件中限制 URI 字符?

我正在使用干净的 URL 进行搜索。如果用户键入单引号,则表示不允许的 URI 字符。而且我知道如何使字符出现在 URL 中。我想知道允许某些字符(如大括号、引号等)的安全漏洞?

我想通过解释或外部参考等任何方式了解这一点。

0 投票
4 回答
1131 浏览

codeigniter - 在 Codeigniter 中,一些 URI 会通过 index.php,而一些则不会

基本上一个控制器 (controller/topics.php, http://192.168.1.50/topics ) 像它假设的那样通过 CI 的 index.php 传递,而另一个 (controller/user.php, http://192.168.1.50/user ) 出于某种奇怪的原因根本没有通过(我在浏览器中收到 404 错误)。CodeIgniter 和/或 Apache2 正在做一些时髦的事情,我想不通:'.../user' 给了我 Apache 的 404 页面,但 '.../User' 给了我 CI 的 404 页面,这意味着 CI 使用大写控制器名称并忽略一些具有小写控制器名称的 URI(然后 Apache 尝试处理 URI)。

任何想法为什么以及如何解决?

PS - 是的,我确实在 CI 的论坛上发布了我的问题,但我没有得到他们的帮助。我在 Linux 发行版(带有 LAMP 的 Ubuntu 10.10)上运行 CodeIgniter 2.0.2。

0 投票
1 回答
419 浏览

codeigniter-url - 如何通过在域名之后传递用户名来显示用户配置文件

我正在使用 Codeigniter 创建一个站点。当客户在域之后键入他的用户名时,我必须显示客户个人资料页面,例如“www.mydomain.com/username”。请给我一个建议。提前致谢...

0 投票
3 回答
347 浏览

codeigniter - Codeigniter 路由

我有这些网址:

如何删除 URL 中的“家”?

0 投票
2 回答
798 浏览

codeigniter - How to convert _ to - in urls for codeigniter?

Been trying to learn codeigniter, 1 problem I had though is that if I had a function say

top_10()

It would mean that my urls will be something like

..../top_10/

Which is fine but I prefer - more than _ for urls. I tried changing my function names to top-10(), but it results in a syntax error it seems (even if it doesn't it results in a ugly function name), Is there a way to let codeigniter auto converts all the _ in my controller functions to - when it comes to the urls?

.../top_10/ -> .../top-10/ for all other similar controller functions.