session - php request_uri returns image path -


recently started writing url routing script in php urls such:

http://www.example.com/messages/drafts

to effect using .htaccess file contains following:

rewriteengine on rewritebase /  rewritecond %{http_host} ^example.co [nc] rewriterule (.*) http://www.example.co/$1 [r=301,l]  rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule . /index.php [l] 

now templates of requested pages loaded through page class , on pages there switch statements determine command executed... so:

http://www.example.com/messages/drafts

would be; load messages.php , execute drafts command, must logged in this. if not logged in redirects login page , sets session variable contains error message , previous page restricted.

for reason when url contains more /messages or /user_home etc. sets session variable /messages/img/bg.jpg...

the ending path image on login page.

i set session $_session['last_page'] = $_server['request_uri'];and verify elsewhere.

does 1 have idea why happening? i'm getting idea problem in .htaccess.

when page done loading echo request uri , should be.

i've had same problem similar setup when using relative links. problem apache tries process background image same way other request. workaround i'm using absolute paths:

background-image: url:("http://yoursite.com/images/background.png"); 

instead of:

background-image: url:("/images/background.png"); 

i don't know if there's more elegant solution, me works fine.

clarification:

i mean redirect working, when web server parsing login page, treats reference background image same way url written in address bar.

also there's problem relatives paths , url rewriting, since when open www.yoursite.com/something , have link relative path /image.png, interpreted mean www.yoursite.com/something/image.png


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -