Welcome Guest, Not a member yet? Register   Sign In
Problem with URLs
#1

[eluser]bondjp[/eluser]
I have this problemn and just don't know how to solve it.
When i put this url:
Code:
http://mysite.com/memb/postback/postback.php?sid=10&name=myname
[
The postback works but if i try to go to other parts of the site i redirects me to the homepage.

If i put this like it should be :
Code:
http://mysite.com/memb/postback.php?sid=10&name=myname
I get a 404 error.
Putting PATH_AUTO it sends me to the homepage.
How can i make this work?

Library:
Code:
class MY_Input extends CI_Input
{
    function MY_Input()
    {
        parent::CI_Input();
        $pos = strrpos($_SERVER['REQUEST_URI'], '?');
        $qry = is_int($pos) ? substr($_SERVER['REQUEST_URI'], ++$pos) : '';
        parse_str($qry, $_GET);
    }
    
}

Config:
Code:
$config['uri_protocol']    = "REQUEST_URI";


Controller "memb":
Code:
function postback(){

                                
        $subid=$this->input->get('sid',TRUE);
        $survey=$this->input->get('name',TRUE);
....................................
}

htaccess
Code:
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^sys.*
RewriteCond $1 !^(index\.php|images|js|captcha|robots\.txt|css)
RewriteRule ^(.*)$ /index.php/$1 [L]


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.  
    ErrorDocument 404 /index.php
</IfModule>
#2

[eluser]pickupman[/eluser]
Wouldn't it be
Code:
http://mysite.com/memb/postback?sid=10&name=myname
#3

[eluser]bondjp[/eluser]
[quote author="pickupman" date="1280039072"]Wouldn't it be
Code:
http://mysite.com/memb/postback?sid=10&name=myname
[/quote]

Yes but if i put it like that i get a 404...
#4

[eluser]bondjp[/eluser]
Another thing is if i put like this:

Code:
http://mysite.com/memb/postback

I works. but if i put like this (add .php):

Code:
http://mysite.com/memb/postback.php

I get a 404....
#5

[eluser]pickupman[/eluser]
Ah, you didn't mentioned you tried that url. You had .php in the url.
#6

[eluser]pickupman[/eluser]
that's becuase postback.php is not a url. Remember index.php is doing all the work. So it's actually
index.php/memb/postback

The index.php is just hidden with .htaccess. Everything is just a query string to it.
#7

[eluser]bondjp[/eluser]
Ok. So how can i solve this?
#8

[eluser]pickupman[/eluser]
Don't use .php in your url's. It's not needed.
#9

[eluser]bondjp[/eluser]
[quote author="pickupman" date="1280040327"]Don't use .php in your url's. It's not needed.[/quote]

The problem is that the ad network uses this format in order to setup the postback url so i can have GET variables...
Can i use it like? :
Code:
http://mysite.com/memb/postback?id=76&name=namesds

If so i still get a 404 with this url...
#10

[eluser]pickupman[/eluser]
Check out this [url="http://www.askaboutphp.com/58/codeigniter-mixing-segment-based-url-with-querystrings.html"]post[/url]. I have used this before, and it worked. It seems you are close, but you have the code in the input class. It should be in your controller constructor as outlined in the post.




Theme © iAndrew 2016 - Forum software by © MyBB