Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I get a 404 page when loging in to wordpress for all my users. It adds an extra "/" so its like website.com//

I am using:<?php wp_loginout(urlencode($_SERVER['REQUEST_URI'])); ?>

So that after a user logs in, it brings them back to where they were.

Is there something wrong with that code? Any ideas? This might help: http://pastebin.com/28tURS8m Thanks

share|improve this question
    
Is there a reason why you're running urlencode() on REQUEST_URI? It appears WP already has an esc_url() function that parses that variable when you run wp_loginout. Perhaps too much escaping is causing the extra slash? –  James Jun 19 '10 at 3:42
add comment

1 Answer

up vote 0 down vote accepted

OK. I actually had a few minutes to test this on my Wordpress 2.9.2 blog.

The issue you are having, as mentioned in my comment, is that you're escaping $_SERVER['REQUEST_URI'] in your paramters of wp_loginout(). That function, wp_loginout(), already has a url cleanser called esc_url().

So, if you just write...

<?php wp_loginout($_SERVER['REQUEST_URI']); ?>

... your code will work as you want it to.

share|improve this answer
    
James works great. I really appreciate it. I had taken the code from some forum, no idea what it meant. Wish i could give you plus1 :) not enough reputation... –  thegreyspot Jun 19 '10 at 4:33
    
No worries. I'm glad it worked. Escaping strings can always be a tricky endeavor in PHP development. Every function does it different or behaves in a way that puzzles one for hours. –  James Jun 19 '10 at 6:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.