For example, visitor types www.website.com/index. I want to remove index and show this url www.website.com

In .htaccess wrote

RedirectMatch 301 /index https://www.website.com

As result instead of https://www.website.com get https:///www.website.com/?index with 404 error.

Please advice what is the correct way to redirect.

Some solution.

Did it not in .htaccess, but in php file.

This works

if( trim($_SERVER['REQUEST_URI']) == '/index' ){ 
header('Location: https://www.domain.com', true, 301 );

but may be some better solution?

1 Answer 1


You probably can find all you need in the ExpressionEngine documentation which discusses this issue and provides some sample code.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.