Answer the question
In order to leave comments, you need to log in
How to transfer to the main from non-existent 3rd level domains?
Visitors often go to 3rd level domains that no longer exist.
As in a regular hosting, carefully transfer them to the main second level,
so that they do not see a non-existent page
(It is useless to remember all the subdomains that were before and create them)
ps. 3 domains are not used at all, that is, it is possible for all subdomains of the 3rd level to be automatically transferred to the main
Answer the question
In order to leave comments, you need to log in
In .htaccess, write something like:
ErrorDocument 404 /index.php
Then, for any 404 error, it will be redirected to the main page of your site (if it is index.php)
What web server do you use nginx or apache?
In nginx, I do this:
:/# cat /etc/nginx/conf.d/default.conf
server {
listen 80 default_server;
server_namelocalhost;
error_page 403 = /403.html;
location = /403.html {
root /usr/share/nginx/html;
internal;
}
location / {
deny all;
}
Server_name can be generally left empty.
Accordingly, if there is a config for the domain, then it is processed, if there is no config for the requested domain, then it sends to 403, well, or to any other page you want.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question