A
A
Andriy Sub2019-10-29 19:51:23
htaccess
Andriy Sub, 2019-10-29 19:51:23

How to redirect?

I need from this
https://domain.com/current/public/3c/bitovaya-tehnika
to
https://domain.com/3c/bitovaya-tehnika
I try in .htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.*)$ current/public/$1 [L]

    # Handle Authorization Header
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

I have a Deploy Laravel project in the current/ folder

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-10-29
@dodo512

If this is your own server and you have access to the VirtualHost settings, then just add /current/public to the DocumentRoot and you won't have to fool around with .htaccess files.
If shared hosting, then add to the current/public/.htaccess file:

RewriteCond %{THE_REQUEST} " /current/public/(\S*)"
RewriteRule ^ https://%{HTTP_HOST}/%1 [R=301,L,NE]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question