0

I have a url:

http://www. my site .com/cms/forum/users/username/

I need it to redirect to:

http://www. my site .com/forum/users/username/

So the cms part of the url needs to go away. What is my regex, and where in the folder structure do I put it? In other words do I add this regex to the .htaccess in the root of the site or in the .htaccess in the cms folder or someplace else?

1 Answer 1

1

You can use RedirectMatch for this task

RedirectMatch /cms(/.*) $1

You can also give a status to it, for example

RedirectMatch 301 /cms(/.*) $1

From the manual

Context: server config, virtual host, directory, .htaccess

This means, you can use it in your main server config, the virtual host config for your site or in the .htaccess file, wherever it fits best.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.