Check string before doing sub
Check for variable to handle index and product page