Title: Undefined index: SCRIPT_URI
Last modified: May 13, 2020

---

# Undefined index: SCRIPT_URI

 *  Resolved [dr](https://wordpress.org/support/users/daniel_richard/)
 * (@daniel_richard)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/)
 * Latest update causing errors.
 * Undefined index: SCRIPT_URI
    wp-content/plugins/litespeed-cache/src/router.cls.
   php:657

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

 *  [markben20](https://wordpress.org/support/users/markben20/)
 * (@markben20)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12830631)
 * Notice: **Undefined index: SCRIPT_URI** in /wpcontent/plugins/litespeedcache/
   src/router.cls.php on line 657
 *  [deh09](https://wordpress.org/support/users/ivan09/)
 * (@ivan09)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12830917)
 * /wp-content/plugins/litespeed-cache/src/router.cls.php on line 657
 * same here
 *  [needforbeans](https://wordpress.org/support/users/needforbeans/)
 * (@needforbeans)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12831340)
 * The error comes up because the server doesn’t even have a SCRIPT_URI index in
   the array. You can solve the error by replacing the serve_static function in 
   the file router.cls.php with this:
 *     ```
       public static function serve_static()
       	{
       		if( array_key_exists('SCRIPT_URI', $_SERVER)) {
   
       			if ( strpos( $_SERVER[ 'SCRIPT_URI' ], LITESPEED_STATIC_URL . '/' ) !== 0 ) {
       				return ;
       			}
   
   
   
       			$path = substr( $_SERVER[ 'SCRIPT_URI' ], strlen( LITESPEED_STATIC_URL . '/' ) ) ;
       			$path = explode( '/', $path, 2 ) ;
   
       		}
   
       		if ( empty( $path[ 0 ] ) || empty( $path[ 1 ] ) ) {
       			return ;
       		}
   
       		switch ( $path[ 0 ] ) {
       			case 'avatar' :
       				Avatar::get_instance()->serve_satic( $path[ 1 ] ) ;
       				break ;
   
       			case 'cssjs' :
       				Optimize::get_instance()->serve_satic( $path[ 1 ] ) ;
       				break ;
   
       			default :
       				break ;
       		}
   
       	}
       ```
   
 * If you don’t want to edit code, just replace the whole router.cls.php file with
   this: [https://pastebin.com/gtbbJ006](https://pastebin.com/gtbbJ006)
    -  This reply was modified 6 years ago by [needforbeans](https://wordpress.org/support/users/needforbeans/).
 *  Plugin Support [Hai Zheng⚡](https://wordpress.org/support/users/hailite/)
 * (@hailite)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12833963)
 * This is fixed in v3.1-rc1. Will be included in next release.
 *  [samtulana](https://wordpress.org/support/users/samtulana/)
 * (@samtulana)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12835526)
 * Hello. I have the same error.
 * Undefined index: SCRIPT_URI
 * > [View post on imgur.com](https://imgur.com/GolIHmN)
    -  This reply was modified 6 years ago by [samtulana](https://wordpress.org/support/users/samtulana/).
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12840590)
 * Hi,
 * [@samtulana](https://wordpress.org/support/users/samtulana/) yes , it’s fixed
   in next release.
 * Best regards,
 *  [samtulana](https://wordpress.org/support/users/samtulana/)
 * (@samtulana)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12840653)
 * Thank you very much. I’ll be waiting.
 *  Thread Starter [dr](https://wordpress.org/support/users/daniel_richard/)
 * (@daniel_richard)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12840697)
 * Marking as resolved as:
 * – needforbeans have provided a quick copy-and-paste patch as a current solution
   –
   hai and qtwrk have assured us about the fix in the next release
 * Thanks for your help all! 🙂
 *  [Kamfret Crew](https://wordpress.org/support/users/design4rt/)
 * (@design4rt)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12866132)
 * Hi how to solved this?
 * I’am already update plugin to 3.1 ver and copy code form [@needforbeans](https://wordpress.org/support/users/needforbeans/)
   but it’s still error.
 * wp-content/plugins/litespeed-cache/src/router.cls.php on line 657
 * #EDITED
 * Already fixed, dunno why but if cache empty the notice will show
    -  This reply was modified 6 years ago by [Kamfret Crew](https://wordpress.org/support/users/design4rt/).
 *  Plugin Support [Hai Zheng⚡](https://wordpress.org/support/users/hailite/)
 * (@hailite)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12866150)
 * That error was logged before you upgraded to v3.1. You can safely clear or ignore
   it. After cleared, you will not see it anymore as you are using v3.1 now.
 *  [Kamfret Crew](https://wordpress.org/support/users/design4rt/)
 * (@design4rt)
 * [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12866177)
 * [@hailite](https://wordpress.org/support/users/hailite/) okay already fix, thanks
   anyway

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

The topic ‘Undefined index: SCRIPT_URI’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

 * 11 replies
 * 8 participants
 * Last reply from: [Kamfret Crew](https://wordpress.org/support/users/design4rt/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/undefined-index-script_uri/#post-12866177)
 * Status: resolved