.htaccess redirectMatch except base

I have this redirect working beautifully:

RedirectMatch 301 ^/stories/(.*)$ /$1

Read More

What I need to happen is happening; all sub-pages of /stories/ (eg: example.com/stories/my-story/ redirects to example.com/my-story/). Great.

Now, I need the base url of example.com/story/ to redirect to example.com/blog/ I’ve tried the following before and after the redirectMatch:

Redirect 301 /stories/ http://dev.explorersedge.ca/blog/

No go. Any ideas?

Thanks,
Jason

Related posts

Leave a Reply

1 comment

  1. Place the following redirect, acting on exact /stories/ or /stories URLs (not required presence of the / is defined by ? in regexp),

    RedirectMacth 301 ^/stories/?$ http://dev.explorersedge.ca/blog/
    

    above your existing RedirectMatch, or below it, but modify, in that case, existing to

    RedirectMatch 301 ^/stories/(.+)$ /$1
    

    so, that it will work only for /stories/ with at least one symbol after it (otherwise .* matches 0 or any number of symbols).