How to set up a redirect from subfolder to domain?

Hello!
Please tell me how in the link https://zabeg.topligarun.ru/subdomains/zabeg/gorod225/ remove the "/subdomains/zabeg". to get https://zabeg.topligarun.ru/gorod225/

Instead of "gorod225" there may be other options.
June 5th 19 at 21:25
1 answer
June 5th 19 at 21:27
RewriteRule ^subdomains/zabeg/(.+)$ /$1? [L,R=301]
Redirects, but the page will not open - error "Invalid redirect"page
And if you go with zabeg.topligarun.ru the link https://zabeg.topligarun.ru/gorod225/ - too does not work, here is a link, it turns out - zabeg.topligarun.ru:443/gorod225 - Helga.Wolf commented on June 5th 19 at 21:30
, DET .htaccess in the Studio - Lavern_Schuppe commented on June 5th 19 at 21:33
Options-Indexes
An ErrorDocument 404 /404.html
Redirect 301 /catalog/index.php <a href="https://topligarun.ru">https://topligarun.ru</a>

RewriteEngine On


RewriteCond %{HTTP_HOST} ^zabeg\.topligarun\.ru
RewriteCond %{REQUEST_URI} !^/bitrix
RewriteCond %{REQUEST_URI} !^/subdomains/zabeg
RewriteRule ^(.*)$ /subdomains/zabeg/$1 [L]

RewriteCond %{HTTP_HOST} ^camp\.topligarun\.ru
RewriteCond %{REQUEST_URI} !^/bitrix
RewriteCond %{REQUEST_URI} !^/subdomains/camp
RewriteRule ^(.*)$ /subdomains/camp/$1 [L]

RewriteCond %{HTTP_HOST} ^club\.topligarun\.ru
RewriteCond %{REQUEST_URI} !^/bitrix
RewriteCond %{REQUEST_URI} !^/subdomains/club
RewriteRule ^(.*)$ /subdomains/club/$1 [L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTPS
RewriteRule ^index\.php$ <a href="https://topligarun.ru/">https://topligarun.ru/</a> [R=301,L]

AddType application/x-httpd-php .html .htm .txt

#RewriteCond %{HTTP_HOST} ^krasnodar.(.*)$ [NC]
#RewriteRule ^(.*)$ <a href="http://%1/$1">http://%1/$1</a> [R=301,L]

#my rules

#RewriteRule ^subdomains/zabeg/(.+)$ /$1? [L,R=301]

#RewriteCond %{SERVER_PORT} ^443$ [OR]
#RewriteCond %{HTTPS} =on
#RewriteRule ^(.*)$ <a href="http://topligarun.ru/$1">http://topligarun.ru/$1</a> [R=301,L]

#my rules

RewriteCond %{REQUEST_METHOD} =GET
 # Identify the GET request in the URL (not POST).
RewriteCond %{REQUEST_URI} ^(.*)/index\.php$
 # URL contains index.php in the end.
RewriteRule ^(.*)$ %1/ [R=301,L]
 # Delete index.php URL.

RewriteCond %{REQUEST_URI} !\?
RewriteCond %{REQUEST_URI} !\&
RewriteCond %{REQUEST_URI} !\=
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_URI} !\/$
RewriteRule ^(.*[^\/])$ /$1/ [R=301,L]

RewriteBase /
RewriteRule ^api/login/(.*)$ / [L,R=301]


Now the line zakamenela in #my rules - Helga.Wolf commented on June 5th 19 at 21:36

Find more questions by tags Nginx