B
B
Bogdan2021-01-18 11:54:48
htaccess
Bogdan, 2021-01-18 11:54:48

How to remove index.php inside url?

Need to get rid of index.php inside url.
The structure is the following:
domain.com/index.php/catalog/
the catalog section exists and opens, but I can't get rid of index.php, since all the information I found comes down to a redirect with index.php at the end. Can you recommend something?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2021-01-18
@abogdan

RewriteCond %{REQUEST_URI} ^(.*)/index\.php$
   # URL cодержит index.php в конце.
RewriteCond %{REQUEST_METHOD} =GET
   # Выявляем GET запрос в URL (не POST).
RewriteRule ^(.*)$ %1/ [R=301,L]
   # Удалить index.php из URL.

maybe in your case you will need to remove RewriteCond %{REQUEST_METHOD} =GET but it already depends on your engine

S
Stalker_RED, 2021-01-18
@Stalker_RED

If you have apache, you can use mod_rewrite.
Here is the first article that came across with a description: https://habr.com/en/post/83597/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question