Answer the question
In order to leave comments, you need to log in
How to change symbolic links to files?
Now we have to move from one domain to another, but on the same server. And every file on the site is displayed through symbolic links. I will copy the files to the new domain. Symbolic links can also, but... Naturally, they will point to the old domain. That's where the two questions come from.
1 - is it possible to massively change the names of all symbolic links not completely, but only in their site.ru names to site1.ru?
2 - Is it possible to change the domain name site.ru to site1.ru in the path to the file of each link without creating new symbolic links, or just select all 130K records from the database of files and create links from scratch?
Answer the question
In order to leave comments, you need to log in
grep -rl старое_имя_домена /путь/к/каталогу_сайта/
Lists all files containing the old domain name. If there are not enough of them, you can manually change them to a new domain name.
find /путь/к/каталогу_сайта/ -type f -exec sed -i 's/https\:\/\/старое_имя_домена.ru/https\:\/\/новое_имя_домена.ru/g' {} +
I riveted this option (maybe someday it will come in handy). The first line does not contain dangerous commands, and after it you can visually check the contents of the text file.
find /каталог/где/симлинки -type l \( -exec readlink {} \; -exec echo {} \; \) |xargs -L2|sed 's/site.ru/site1.ru/g' > aaaa.txt
cat aaaa.txt|awk '{print $2}'|xargs rm
cat aaaa.txt|xargs -L1 ln -s
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question