How to set the path to the subsite in a folder?

The path to the subsite in a folder like this:

law-jus.ru/landings/kadastr

Want all subsites was in the folder /landings/ but to display each subsite without mentioning in the way of landings, and so law-jus.ru/kadastr

How can I do that?
March 19th 20 at 09:20
1 answer
March 19th 20 at 09:22
You can just learn to use the search engine.

Here is an example of this.
Often when migrating a site from one platform to another has to take care of was redirected from the old pages to the new need to remove one level of url, such as catalog or the product.

The situation is quite simple, look at the decision with our beloved htaccess:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css|woff|woff2|ttf) #exclude from the redirect the files with the given extensions
RewriteCond %{REQUEST_URI} ^.*catalog.* # set the rule of the presence of the phrase in the url
RewriteRule ^catalog/(.*)$ http://%{HTTP_HOST}/$1? [R=301,L] # perenapravljat to a new url

The advantage of this construction is that, regardless of nesting, the redirect virus will come to the correct URLs.

Example:

site1.com/catalog/split_sistemy

lead with equal success on

site2.com/split_sistemy

or

site2.com/kondicionirovanie/split_sistemy/

depending on the structure of your URLs.

Works perfectly not only with categories but also with the goods - it's very cool because when you move a directory to another site nesting may be disrupted, and the url of the product still there!

The generic redirect in my vzgdyad, later if there is time, lay out a memo with the values mod_rewrite, knowing that you can redirect anything anywhere.

Find more questions by tags Web DevelopmentCMS