codeigniter $配置['uri_protocol']的问题问题、codeigniter、uri_protocol

2023-09-02 11:42:31 作者:20.轻舞飞扬

我需要改变 $配置['uri_protocol'] 从自动到PATH_INFO(允许URL参数)

I need to change $config['uri_protocol'] from AUTO to PATH_INFO (to allow url parameters)

我的问题:当我设置 $配置['uri_protocol'] =PATH_INFO; 正规网址停止运行,我得到的网页,无论哪个网站页面的URL我点击。

My problem: when I set $config['uri_protocol']="PATH_INFO"; the regular urls stop functioning and I get the homepage no matter which site page URL I click.

的print_r($ _ SERVER)显示,URL参数我想补充只出现在REQUEST_URI一个不以任何其它$ _ SERVER部分。

print_r ($_SERVER) shows that url parameters I add appear only in REQUEST_URI an not in any other $_SERVER part.

我的htaccess是标准的一

my htaccess is the standard one

<IfModule mod_rewrite.c>
    RewriteEngine On

    # This is different between local host and production server!!!
    RewriteBase /


    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

更新:

我改变了

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

重写规则^(。*)$的index.php?/ $ 1 [QSA,L] 来让URL PARAMS通过。现在,URL PARAMS也出现在

to RewriteRule ^(.*)$ index.php?/$1 [QSA,L] to allow url params to pass. Now url params appear also in

 $_SERVER

 REDIRECT_QUERY_STRING, QUERY_STRING AND REQUEST_URI

问题:我想$配置['uri_protocol']与上述所有选项,但仍CI给出错误404,每当我添加URL参数

The problem: I tried $config[‘uri_protocol’] with all the above options but still CI gives error 404 whenever I add URL parameters.

注:我想上面的2台服务器。其中之一是centos5 / Apache2的/ VPS的Plesk,另外一个是XAMPP / Vista系统。

Note: I tried the above on 2 servers. One of them is centos5/Apache2/Plesk VPS and another one is on xampp/Vista.

推荐答案

http://stackoverflow.com/questions/1880807/how-to-remove-url-parameters-in-htaccess

 
精彩推荐