Category Archives: Linux

Some how-to using Htaccess

Some how to using Htaccess:

How to protected SVN Directories with HTACCESS File
This line in the “.htaccess” file will protect all SVN directories (“.svn/”):

<IfModule mod_rewrite.c>
RewriteRule ^(.*/)?\.svn/ - [F,L]

The flag “F” means forbidden, and the “L” flag means the last rule to be used if this rule is used. “-” is used to not change the original request URI. ErrorDocument can also be used with the rule to display a custom error message:

<IfModule mod_rewrite.c>
RewriteRule ^(.*/)?\.svn/ - [F,L]
ErrorDocument 403 "Access Denied"

How to Force HTTPS
#force https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}/ [L]

How to restrict no direct access of index.php
#no direct access of index.php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://%{HTTP_HOST}/ [R=301,L]

How to get all request come to Index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

How to hide file extension
RewriteCond %{REQUEST_URI} !^/(.*)(\.)
RewriteRule ^(.*)$ index.php?do=$1&%{QUERY_STRING} [NC,L]

Image 404 .htaccess
# img not found
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$
RewriteRule .* images/spacer.gif [L]

How to force all URL should be start with www.
#force www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www\.%{HTTP_HOST}/$1 [R=301,L]

How to Redirect 301 using htaccess
Redirect 301 /path/old.htm

How to hide config files to access for outside world
Example, don’t allow access to .ini files:
#no direct access of *.ini
RewriteRule ^(.*)\.ini$ http://%{HTTP_HOST}/ [R=301,L]

Category: Linux | Tags: ,

How to Compress and Unpack an directory in Linux?

For compress file or directory, GNU tar command is best for this work. It can be use on remote Linux or UNIX server. It does two things for you:
– Create the archive
– Compress the archive

Continue reading

Category: Linux | Tags: , , , ,

How to get List of all mounted filesystems on the Linux system?

The mount command mounts a storage device or file-system, making it accessible and attaching it to an existing directory structure.
The umount command “unmounts” a mounted filesystem, informing the system to complete any pending read or write operations, and safely detaching it.

Continue reading

Category: Linux | Tags: , ,

How to get List processes – Linux Commands?

ps is the command which gives us reports a snapshot of the status of currently running processes. The process status command (ps) displays information about active processes.
Syntax: ps [options]

Continue reading

Category: Linux | Tags: ,

How can I determine Linux operating system detail?

How can I determine Linux operating system detail?
uname (short for unix name) is a software program in Unix and Unix-like computer operating systems that prints the name, version and other details about the current machine and the operating system running on it.

Continue reading

Category: Linux | Tags: