Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter iyoworks

    (@iyoworks)

    I created a work around. This is the code I’m using in my functions.php file:

    //redirect to student profile if [homeurl]/[username] is the current url.
    if (!is_admin()) {
    
    $url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
    $url = ereg_replace("(https?)://", "", $url);
    $token = explode('/', $url);
    $token = $token[sizeof($token)-1];
    
    $shortPortfolioUrl = ereg_replace("(https?)://", "", (home_url(''.$token.'')));
    if ($url == $shortPortfolioUrl) {
    	if (username_exists($token) != null ) {
    		$location = home_url().'/portfolios/?'.$token;
    		wp_redirect( $location );
    		exit;
    	}
    }
    
    }
    Thread Starter iyoworks

    (@iyoworks)

    Thanks. The site will probably start with 30-50 students and will grow as more student go through the program. I’m not too versed with the wp_rewrite tag or the .htaccess file. How would I get the second option to work?

Viewing 2 replies - 1 through 2 (of 2 total)