Welcome Guest, Not a member yet? Register   Sign In
Appache mod_rewrite and CI routing
#1

(This post was last modified: 01-02-2023, 10:56 PM by ruslan.)

I have this line in my .htaccess file:
Code:
RewriteRule  "^rpc/(.+)"  "/rpc"  [PT]

It redirects all `/rpc/something` requests to `/rpc`
And it really does, but when CI Router processes the request it still uses the full original URL `/rpc/something`

Code:
message: "Can't find a route for 'post: rpc/something'."


This is some $_SERVER vars:
Code:
["REDIRECT_URL"]=>string(4) "/rpc"
["REQUEST_URI"]=>string(12) "/rpc/something"
["PATH_INFO"]=>string(4) "/rpc"
["PATH_TRANSLATED"]=>string(23) "redirect:\index.php\rpc"
["PHP_SELF"]=>string(14) "/index.php/rpc"

May be CI should use REDIRECT_URL instead of REQUEST_URI?
Reply
#2

See Config/App.php. Replace to PATH_INFO
PHP Code:
public $uriProtocol 'REQUEST_URI'
Reply




Theme © iAndrew 2016 - Forum software by © MyBB