Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


A little NGINX conf regex help
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

A little NGINX conf regex help

So I am trying to regex out some single quotes ' from my site for some products categories and wanted to write a 1 liner for the change instead of several hundred that are baked into google, yet don't resolve.

And yes I fixed the code that was generating those slugs.

Comments

  • MunMun Member

    Shovenose is that you ?

  • @Mun said:
    Shovenose is that you ?

    what happened to him?

  • I have no idea what this person is talking about. Im looking for help with an nginx conf.

  • NickMNXioNickMNXio Member, Host Rep

    Give us an example of the singles quotes-- and we'll give you your one liner!

    Although I'm guessing you're single quoted issue is more complex than this..here is an example to see what removing single quotes from your conf file might look like using sed:

    $ cat example.conf |sed "s/\'//g"

  • jollymonjollymon Member
    edited January 2016

    @NickMNXio said:
    Give us an example of the singles quotes-- and we'll give you your one liner!

    Although I'm guessing you're single quoted issue is more complex than this..here is an example to see what removing single quotes from your conf file might look like using sed:

    $ cat example.conf |sed "s/\'//g"

    So here is what I was trying #rewrite ^/(.*)$'(.*)$ /(.*)$ (.*)$;
    in my nginx.conf. Im trying to regex out the ' character from my URI

  • NickMNXioNickMNXio Member, Host Rep

    I would think the rewrite line should look more like this (although untested):

    rewrite ^/(.*)'(.*)$ /$1$2 last;

  • NickMNXioNickMNXio Member, Host Rep

    Actually tested this and it works for me:

    rewrite ^/(.*)'(.*)$ /$1$2 redirect;

  • @NickMNXio said:
    Actually tested this and it works for me:

    rewrite ^/(.*)'(.*)$ /$1$2 redirect;

    That did it! Awesome

    Thanked by 1NickMNXio
Sign In or Register to comment.