Category Archives: Codes

Debian – How to delete files older than X days

Hey, recently I have wondered what is the CLI command that I have to use in order to delete all the files older than X days. Using a debian server I have to use a linux command to do that.

I have discovered that I have to use the “find” command to filter those files first and then select them to delete.

Command Sintax:

find /path/to/files* -mtime +5 -exec rm {} \;

This searches for files older than 5 days in the mentioned folder and delete them all.

Explanation

The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.
The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.

This should work on Ubuntu, Suse, Redhat, or pretty much any version of linux.

How to redirect the old domain to the new one?

A question that appears on move: How to redirect the old domain to the new one?

I have a blog, and can be read at http://blogvechi.com and decide that it’s time to move him, to do something new, to bring more of the written or any other reason, the address http: // blognou.com.

After you make sure everything is copied and installed in the new location, I noticed that my readers are still looking for the old address and the new one does not get anyone to read. All you have to do is to define the root htaccess file redirecting the old site.

This denotes that you are still old domain owner.

The few lines can help me get rid of this problem and other problems that result from such a move.

When you migrate a site from one domain to another, it is important not to break all ties that you were built to the old you. Proper forwarding of all pages on the old domain to the same location on the new field will ensure that our old domain will get to the right place. Without this redirection will have a loss of visitors and search engine rankings.

Suppose your web server using Apache for the purpose of this tutorial. If you have not made ​​changes to the structure of your site overall, and you simply moved the site in its current state, you can add the following lines to the file located in the old root domain htaccess .

<IfModule mod_rewrite.c>   
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule(.*)$http://www.newdomain.com/$1[R=301,L]
</IfModule>

Is it possible to create rules that will redirect URLs that follow a certain pattern to a new location. Since these rules involve complex regular expressions, they are not explained here. A professional SEO can help you to create these complex rules in a specific situation. Just make sure you use a 301 redirect for content moved. Any other type of redirection will not keep your search engine rankings (Google for example).

Description Meta TAG

Meta tags have never been a guaranteed way to gain a top ranking on crawler-based search engines. Today, the most valuable feature they offer the web site owner is the ability to control to some degree how their web pages are described by some search engines. They also offer the ability to prevent pages from being indexed at all.
Meta description tags consist the knowledge on seo and google recommendations on writing meta description tags, length, limits, guidelines, suggestions, character limits, optimization strategies, components and etc.

Enter your blog description between the one quote marks beneath description. You can use a max. of a hundred and fifty characters.

Mobile and Tablets sites

More of the people I know, started to complain that the browsers on smartphones and tablets do not have convenient sites with easy and accessible interface for this type of Internet user. For that, it seems that is required by the site administrator so dedicated to present a version specially created for these visitors. Server-side settings can implement a redirection of these visitors to a page dedicated to using the .htaccess file of that site. Continue reading Mobile and Tablets sites

Secure Your Site (.htaccess)

 Secure Your Site (.htaccess)

One way to prevent unwanted access of your site is using the file .htaccess

Reasons:
– Restrict access to a known hacker / bot from accessing your site
– Allowing only certain IP addresses to view your site (while in development, for example)
– Allow only trusted individuals in your site (if your users IPs remain the same, because it’s safer)
– Banning people from a particular country (or any location unknown) to access your site
– Ban people from your site
Continue reading Secure Your Site (.htaccess)

Amateur Server – Debian & Virtualmin

I know that when it comes to linux and run many say it’s hard. However, this impression remains only an impression that you remember fondly when you think about it that you ever had.

Needing a web server preferably contains Apache , MySQL and PHP that is not conditional on the money I got and I set up a unit using an older PC.
In Debian , you can install using manuals quite intuitive, the above can be installed following several options but my favorite version was a installation that includes a server manager as Virtualmin . This manager gives me the opportunity to manage multiple servers on the same drive (hardware) and I chose version under GPL (Open Source). Continue reading Amateur Server – Debian & Virtualmin