D
D
delaf2014-04-14 15:40:24
Web servers
delaf, 2014-04-14 15:40:24

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

2 answer(s)
R
rustelecom, 2014-04-14
@rustelecom

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)

A
Antony Ryabov, 2014-04-14
@tonymadbrain

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 question

Ask a Question

731 491 924 answers to any question