How to rewrite all same files to sites in root via SSH? - ssh

I have a hundred same sites in my root directory i want to modify one page and i must rewrite all sites , is there any easy way to modify them.
You can think as this, you have VPS root server and you set up 100 joomla in your server. They have different databases but all of them are same files.
And you must change footer.php file so what will you do?
You must open root and replace the footer file to all sites one by one.
And so it is a hard way. There must be easy way via SSH or Php codes, etc..
Thanks alot.

Use the editor of your choice and batch process all the files.
e.g. on Windows, mount the folder as a network drive, open all footer.php files in Notepad++ and do a search and replace on all open files.
e.g. on the Unix command line, use find (maybe xargs) and sed or vim -c. alternatively to something like the Windows approach with e.g. Sublime text or any other editor.

Related

Is it possible to work with an editor remotly?

I want to edit files on my server, but don't want to always upload the files, is there a way on to edit the files remotly?
I tryed to make an bash script which should upload the files, but its not realy good :/ and sometimes didn't worked
You can use Atom with the
Retome FTP edit
Package
If you have got an SSH (SFTP enabled) access to your server, an option would be use use SSHFS to mount a remote directory on your local working path.
In this way you can use any editor (or even something else) to change your files and they will always be synchronised.
Just keep in mind that, in this way, files are actually located on your server, you won't have a real copy on your local machine.

Web server: how to allow users to browse into compressed files?

I'm looking for an Apache configuration, module, or perhaps cgi/php/whatever script to allow users of my website to not only browse directories but also browse right into compressed .zip files (*) in those directories as if they were regular directories.
Background:
I run an Apache web server and one of the services it provides is a simple directory listing to some files that people need access to.
Some of these files are compressed (*) and generally that is good because people normally want to download the whole thing. However it would be really useful if it were also possible to seamlessly browse into the compressed files just as if they were regular folders.
While I could write a cgi script to do this myself, surely this has been done before. Surely, although my web searches have not found one, there's just an Apache module to do it.
Any pointers?
Steve
(*) Using .zip, not .tar.bz2, alas. It's a requirement, don't blame me.

Apache - Access files from multiple different folders

Is there anyway to have a bunch of iframes on one html page that link to several different text files located elsewhere on the server?
For example, if my apache server hosts its HTML pages in:
C:\Apache\WebDocs,
Is there anyway to link several different log files from different locations like" C:\game1\logs\log.txt and C:\GameServer\logs\console.txt all into one webpage using iframes?
I suggest you create shortcuts to your current apache document root and give apache user read permission to the original file. Personally, I haven't tested this on a windows machine. Otherwise, you can use Alias directive.
Alias /log1 C:\game1\logs\
and you can call the url as http://localhost/log1/
That should help as well.

Creating .htaccess files (Ubuntu Server 12.04 w/ Apache2)

Whenever I create an .htaccess file in a directory it disappears. I am running a VPS at Digital Ocean (I have full control over the server). So I can't see why my .htaccess files are automatically deleted upon creation. I even tried to make the file on my computer and just transfer it to the directory via FTP but as soon as it transfers, it disappears. I checked the log of the FTP transfer and the file transferred successfully. I can't figure this out.
Its because system files are hidden on apache servers... Either select the option to see hidden files if you're using a GUI or type the command "ls -a" if you're on terminal and you should see the files. Any file that starts with a dot is going to be hidden by default. Your .htaccess files fall within the same category.
If you want to be able to view the .htaccess file on the server, make sure you are logged in as the root user, or a user with root level permissions.
Then, navigate yourself to "/home/username/public_html(in my case)" And if you have a .htaccess file uploaded, it should be displayed there.

.htaccess: where is located when not in www base dir

I may need to modify our .htaccess file. Problem is I can't find it. We have several subdomains along side each other in the vhosts directory, and each subdomain has an associated .htpasswd file. How can find where the .htaccess file is.
Obviously, I didn't set this up and I'm certainly not known as an unix admin expert.
. (dot) files are hidden by default on Unix/Linux systems. Most likely, if you know they are .htaccess files, then they are probably in the root folder for the website.
If you are using a command line (terminal) to access, then they will only show up if you use:
ls -a
If you are using a GUI application, look for a setting to "show hidden files" or something similar.
If you still have no luck, and you are on a terminal, you can execute these commands to search the whole system (may take some time):
cd /
find . -name ".htaccess"
This will list out any files it finds with that name.
The .htaccess is either in the root-directory of your webpage or in the directory you want to protect.
Make sure to make them visible in your filesystem, because AFAIK (I'm no unix expert either) files starting with a period are invisible by default on unix-systems.