Answer the question
In order to leave comments, you need to log in
How to set the path to a subsite in a folder?
The path to the subsite in the folder is:
law-jus.ru/landings/kadastr
I want all subsites to be in the /landings/ folder, but each subsite is displayed without mentioning landings in the path, but like
this law-jus.ru/kadastr
It can be done?
Answer the question
In order to leave comments, you need to log in
You can just learn how to use the search first.
Here is an example.
Often, when moving a site from one platform to another, you have to take care of the redirect from old pages to new ones, you need to remove one level of the url, for example catalog or product.
The situation is quite simple, let's look at the solution using our favorite htaccess:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg| png|js|css|woff|woff2|ttf) # exclude files with these extensions from the redirect
RewriteCond %{REQUEST_URI} ^.*catalog.* # set the rule for the presence of the phrase in the URL
RewriteRule ^catalog/(.*)$ http:/ /%{HTTP_HOST}/$1?[R=301,L] # redirect to a new url
The advantage of this design is that regardless of the nesting, the redirect will come to the correct urls.
Example:
site1.com/catalog/split_sistemy
will lead equally well to
site2.com/split_sistemy
or
site2.com/kondicionirovanie/split_sistemy/
depending on your URL structure.
It works great not only with categories, but also with products - it's very cool, because. when transferring the catalog to another site, the nesting may be violated, but the product url will still be found!
The most universal redirect in my opinion, later, if I have time, I will post a memo with mod_rewrite values, understanding that you can redirect anything anywhere.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question