Rich-text Reply

Optimizely is adding a part to the URL which is breaking the search function of the site

ThomasTheTank 10-23-14

Optimizely is adding a part to the URL which is breaking the search function of the site

Hi,

 

I am running a new homepage test, using two separate pages:

 

Original - http://www.example.com

Variation - http://www.example.com/en/

 

When users perform a search from the Variation page they are sent to:

 

http://www.example.com/en/?s=SEARCH+TERM

 

The /en/ that is present in the URL breaks the search function and they get a 404 error.

 

I have tried redirecting with htaccess:

 

redirect 301 /en/?s=* http://www.example.com/?s=*

 

But that doesn't work either.

 

Any ideas?

Re: Optimizely is adding a part to the URL which is breaking the search function of the site

Additional Info:

I paused the Optimizely testing and everything works fine. If I manually go to example.com/en/ the search function performs just fine.
Amanda 10-24-14
 

Re: Optimizely is adding a part to the URL which is breaking the search function of the site

Hey @ThomasTheTank  (love your username by the way!)

 

Sounds like you are only trying to run your experiment on the homepage, not site wide. Is this correct?

 

If so, then you can get around the issue you are explaining by ensuring the redirect *does not* happen on the search page. To do this, set a simple match to the homepage URL and add an audience that *excludes* the query string parameter "s"

 

This way, your redirect will happen only on the homepage, and it will not happen when the user views the search page. Visitors in the variation will land on http://www.example.com/en/, search, and then land on http://www.example.com?s=search_term. 

 

Let me know if you need the experiment and addition of the /en/ to happen on the search page for some reason and I can brainstorm some other ways to fix the issue. 

 

 

Optimizely