1

I want to make a redirect to my htaccess with the follow:

http://example.com/index.php -> http://example.com
http://example.com/index.php/controller -> http://example.com/controller
http://example.com/index.php/controller/any-method -> http://example.com/controller/any-method

In 2 words, i want to detect if the URL contains index.php and redirect it to a url without it but to keep other segments after the index.php

Thank you in advance.

1 Answer 1

3

This worked for me:

RewriteCond %{REQUEST_URI} ^/index.php/
RewriteRule ^index.php/(.*) /$1 [R,L]
Sign up to request clarification or add additional context in comments.

1 Comment

I'm looking for something simular. The solution redirects to a path via the file root not not the web root for me.

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.