• Resolved skunkbad

    (@skunkbad)


    I’ve got a bunch of redirects on a site I’m working on, and so I want to add them to .htaccess instead of letting PHP do the work. Yoast doesn’t want to do this on a Litespeed server, even though Litespeed uses .htaccess and the redirects are the exact same. So I came up with a solution, but just wanted to ask if you think I may run into problems doing this. I put this in my wp-config.php:

    
    if( 
    	// Loading redirect interface, including settings
    	( isset($_GET['page']) && $_GET['page'] == 'wpseo_redirects' ) OR 
    	// Setting options
    	( isset($_POST['option_page']) && $_POST['option_page'] == 'yoast_wpseo_redirect_options' ) OR 
    	// Save a plain redirect
    	( isset($_POST['action']) && $_POST['action'] == 'wpseo_add_redirect_plain' ) OR
    	// Save a regex redirect
    	( isset($_POST['action']) && $_POST['action'] == 'wpseo_add_redirect_regex' ) OR 
    	// Delete any redirect
    	( stripos( $_SERVER['REQUEST_URI'], 'wp-json/yoast/v1/redirects' ) !== FALSE )
    	
    ){
    	$_SERVER['SERVER_SOFTWARE'] = 'apache';
    }
    

    I tested it and as far as I can tell everything works on Litespeed just like Apache.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Yoast Server Redirects on Litespeed’ is closed to new replies.