1 | <?php |
---|
2 | /* |
---|
3 | * Plugin Name: IdeaWebServer / LiteSpeed workaround |
---|
4 | * Plugin URI: http://core.trac.wordpress.org/ticket/9763 |
---|
5 | * Description: Workaround for using WordPress on IdeaWebServer / LiteSpeed. |
---|
6 | * Author: Adam Harley |
---|
7 | * Author URI: http://adamharley.co.uk |
---|
8 | * Version: 0.1 |
---|
9 | */ |
---|
10 | |
---|
11 | |
---|
12 | function is_apache_iws() { |
---|
13 | global $is_apache, $is_apache_workaround; |
---|
14 | |
---|
15 | if ( strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'IdeaWebServer') !== false ) { |
---|
16 | $is_apache = true; |
---|
17 | $is_apache_workaround = true; |
---|
18 | } else { |
---|
19 | $is_apache_workaround = false; |
---|
20 | } |
---|
21 | } |
---|
22 | |
---|
23 | add_action( 'init', 'is_apache_iws', 1 ); |
---|
24 | |
---|
25 | |
---|
26 | function wp_redirect_iws( $location ) { |
---|
27 | global $is_apache_workaround; |
---|
28 | |
---|
29 | if ( $is_apache_workaround && '/' == $location[0] ) |
---|
30 | $location = get_bloginfo('url') . $location; |
---|
31 | |
---|
32 | return $location; |
---|
33 | } |
---|
34 | |
---|
35 | add_filter( 'wp_redirect', 'wp_redirect_iws', 1 ); |
---|