Q
Q
QNA-19762020-01-16 11:19:02
htaccess
QNA-1976, 2020-01-16 11:19:02

How to remove / public from the address bar so that it is perceived as, for example, a controller?

.htaccess/

RewriteEngine on
RewriteRule ^(.*)$ /public/$0

.htaccess /public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?$0 [L,QSA]

The site is available, for example, both at http://site.ru/controller/action and at http://site.ru/public/controller/action, how to remove /public?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-01-16
@QNA-1976

/public/.htaccess

RewriteEngine On

RewriteCond %{THE_REQUEST} ^\S+\s+/public(\S+)
RewriteRule ^ %1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?$0 [L,QSA]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question