Monday, September 1, 2014

Apache Uthentication for single Page

If you don’t current have an .htpasswd, use the “-c” option to create the file with the first user. It will prompt you for a password and encrypt it for you.

htpasswd -c /var/www/domain.com/public_html/.htpasswd user1

Copy and Paste following in .htaccess (Change path and file name according to your ewquirement)
AuthUserFile /PATH-TO-HTPASSWD/.htpasswd
  AuthName "My restricted Area"
  AuthType Basic
# ErrorDocument 401 /test.php
  <Files "vox-videos.html">
   require valid-user
   </Files>

Monday, July 21, 2014

Get the phpMyAdmin's Visual Query Designer

Step 1) open phpMyAdmin/config.inc.php and modify the below lines of code.

/* change this info to whatever user has read-only access to the "mysql/user" and "mysql/db" tables */         
    $cfg['Servers'][$i]['controluser']   = 'root'; //this is the default user for MAMP's mysql
    $cfg['Servers'][$i]['controlpass']   = 'root'; //this is the default password for MAMP's mysql

/* this information needs to line up with the database we're about to create so don't edit it unless you plan on editing the SQL we're about to run */
    $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; 
    $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
    $cfg['Servers'][$i]['relation'] = 'pma__relation';
    $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
    $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
    $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
    $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
    $cfg['Servers'][$i]['history'] = 'pma__history';
    $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
    $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
    $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
    $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';


Step 2)    phpMyAdmin installs with the SQL we need to generate the database that the Designer relies on. We just need to locate the script. In 4.0.7 the file location is phpMyAdmin/examples/create_tables.sql. Alternatively, you can copy/download this from phpMyAdmin's github.
Once you locate the file, either import the file or copy/paste it into a SQL window and execute in phpMyAdmin.
Now, everything should be configured properly. We need to clear cookies and restart the browser.
When you open phpMyAdmin back up, navigate to a specific table and in the tabs you should see Designer tab.

Thursday, July 17, 2014

htaccess rules

# ---- Make pages render without their extension in the url
Options +MultiViews


404 custom file not found page

ErrorDocument 404 /filenotfound.php


Prevent directory or File listing :

IndexIgnore *

Redirect entire domain to another domain

Redirect 301 / http://www.devaraju.com/

Redrect individual pages

Redirect 301 /old.html http://www.devaraju.com/new.html

Redirect entire domain to respective pages

RewriteCond %{HTTP_HOST} !^www.\devaraju\.com
RewriteRule (.*) http://www.devaraju.com/$1 [R=301,L]

.htaccess ip bases restriction

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^111\.22\.333\.444$
RewriteCond %{REMOTE_ADDR} !^123\.22\.46\.56$
RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|png|gif|svg|swf|css|ico|js)$ [NC]
RewriteRule ^ /maintenance.html

Thursday, July 10, 2014

.htaccess redirection

# Redirect to domain with www.


RewriteEngine on

# Redirect to domain with www.
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Same for HTTPS:
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


# Redirect to domain without www.

RewriteEngine on

# Redirect to domain without www.
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule .* http://%1%{REQUEST_URI} [R=301,L]
# Same for HTTPS:
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule .* https://%1%{REQUEST_URI} [R=301,L]


Do not force www/no-www domain

RewriteEngine on

# Redirect to another domain: www.test.org.
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)?test\.org$ [NC]
RewriteRule .* http://www.test.org%{REQUEST_URI} [R=301,L]
# Same for HTTPS:
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^(www\.)?test\.org$ [NC]
RewriteRule .* https://www.test.org%{REQUEST_URI} [R=301,L]


Trailing slash for URLs

RewriteEngine on

# Ensure all directory URLs have a trailing slash.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\/$
RewriteCond %{REQUEST_URI} !\/[^\/]*\.[^\/]+$
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI}/ [L,R=301]
# Same for HTTPS:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\/$
RewriteCond %{REQUEST_URI} !\/[^\/]*\.[^\/]+$
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI}/ [L,R=301]


301 Redirect Directories

#301 Redirect Entire Directory.
RedirectMatch 301 ^/old/(.*)$ /new/$1


# Block users by IP
order allow,deny
deny from 127.0.0.1
deny from 127.0.0.2
allow from all


Change Default Directory Pages

# Change default directory pages.
DirectoryIndex new

Prevent viewing of .htaccess

# Prevent viewing of htaccess file.
<Files .htaccess>
    order allow,deny
    deny from all
</Files>



Change Default Directory Pages

# Change default directory pages.
DirectoryIndex new


Prevent viewing of htaccess file

# Prevent viewing of htaccess file.
<Files .htaccess>
    order allow,deny
    deny from all
</Files>


Prevent Directory Listing

# Prevent directory listings
Options All -Indexes


Compression

# Compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript



Enable Symbolic Links

# Follow symbolic links.
Options +FollowSymLinks

Import and Export CSV file into mysql database

SELECT * from  `table name` INTO OUTFILE 'table.csv' FIELDS ENCLOSED BY '"' TERMINATED BY ';' ESCAPED BY '"' LINES TERMINATED BY '\r\n'

find / -type f -name table name.csv

load data  infile 'table.csv' into table table name fields terminated by ',' enclosed by '"' lines terminated by '\n'

Wednesday, July 9, 2014

Redirect to domain without www.

redirection rule in .htaccess as follows

RewriteEngine on

# Redirect to domain without www.
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule .* http://%1%{REQUEST_URI} [R=301,L]

Saturday, July 5, 2014

Git basic commands

This summary is not available. Please click here to view the post.

iis configuration for drupal clean-urls

web.config as follows

Drupal 6 :

<?xml version="1.0" encoding="UTF-8"?>

    <configuration>

        <system.webServer>

            <rewrite>

                <rules>

                    <rule name="Drupal Clean URLs" stopProcessing="true">

                        <match url="^(.*)$" />

                        <conditions>

                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />

                         
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />

                        </conditions>

                        <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />

                    </rule>

            </rules>

        </rewrite>

    </system.webServer>

</configuration>


Drupal 7 :

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

 <system.webServer>

 <rewrite>

   <rules>

     <rule name="Drupal clean URLs" enabled="true">

       <match url="^(.*)$" ignoreCase="false" />

       <conditions logicalGrouping="MatchAll">

         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />

         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 

         <add input="{REQUEST_URI}" negate="true" pattern="/favicon.ico$" />

       </conditions>

       <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />

     </rule>

   </rules>

</rewrite>

    </system.webServer>

</configuration>

Configuring Vitualhost in apache (Plesk)

 forwarding sub-domain to hosting server(IP).
create dns record in domain section like xxx.domain.com pointing to IP by following the link.
http://sdevaraju.blogspot.in/2014/07/a-step-by-step-guide-on-how-to-create.html

 <VirtualHost x.x.x.x:80>
  ServerName "domain/sub-domain"
  DocumentRoot "path-to site/test"
ScriptAlias  "/cgi-bin/" "path-to site/cgi-bin/"
<IfModule mod_fcgid.c>
    <Files ~ (\.php)>
        SetHandler fcgid-script
        FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
        Options +ExecCGI
        allow from all
    </Files>
</IfModule>
</VirtualHost>

A step by step guide on how to create a sub domain on godaddy account manager

Creating a sub-domain is sometimes handy if you’re looking to test new products or extend your website with secondary complementary material.   It’s often used by companies to create a testing website before launching a new website.  For example most people would use a sub-domain such as www2.mydomain.com  where www2 is pointed to a secondary folder on the web server or any other web server out on the internet.

For the purpose of this tutorial on how to setup a sub domain for your real estate website.  We are going to provide you with the steps you need in order to create a sub-domain on Godaddy, if you purchased your domain through them.

In order to setup a sub-domain on godaddy, you need to ensure that you’re currently logged into the website.   Once you have gained access to your godaddy account proceed by clicking on “My Account“.

Secondly, This page often changes on Godaddy, but you will want to locate the “Domains” link which shows you all the domains you currently have with Godaddy.  This will take you to what is known as your “Domain Manager”.

Third, you will arrive to a list of all the domains you currently have registered with godaddy. From the list below you will click on the domain name for which you would like to create a new sub-domain.

Fourth step is to launch the DNS manager for the domain we selected from the third step.  If you do not seethe “Launch” link on the DNS Manager section, you will need to contact the individuals who are currentlyhosting your website.  They likely have control of your DNS settings for your domain.

Finally,  Once you launched the DNS manager for the domain you were interested in creating for your domain.   You will be presented with the details of all the DNS settings for your particular domain.

In this section you will need to have ready an IP Address where you would want to point the sub domain to.   It’s important that you have this ready before proceeding with the changes.

in the “A (Hosts) section – click on Quick Add.   Enter the desired “host” name and “Points to” IP Address.    Once you entered this information click on Save Zone File.

database backup and remove older files

find and remove files older that 7 days
find /path-to-folder/ -name "dbname_*".sql  -mtime +7 -exec rm {} \;

database backup in compressed form:

ldir=$(mysqldump --routines --single-transaction -u user -ppassword dbname | gzip > /path-to-folder/dbname_`date +"\%Y\%m\%d\%H\%M\%S"`.sql.gz);


find and remove files older that 7 days

find /path-to-folder/ -type f -a -mtime +30 -exec rm {} \;

Thursday, March 6, 2014

PHP Mcrypt on CentOS 6

CentOS 6 still doesn’t by default include mcrypt in it’s distribution on repositories.

There is hope, EPEL to the rescue again:
rpm -ivh http://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum update

You should see EPEL listed as the repos, then:
   
yum install php-mcrypt

Also a few of you have mentioned you need to restart Apache. To do this:
   
service httpd restart

Done.

**Please note the above download is for CentOS 6 x86_64**

Wednesday, March 5, 2014

Skype BIG Login screen problem........

Since Skype 5.10 and above the web-based Skype login/sign-in in window has been around. This window requires a functioning IE (for .html), javascript (.js) and cascading style sheets (.css). Any break in any of those will cause the window not to be displayed correctly.

The HKEY_ROOT value for .css is a global setting that tells the operating system how to treat .css files. CSS is a style sheet language that generally provides additional formatting for .html (Hyper Text Markup Language). Both .html and .css files are treated by the operating system as text (by default). In contrast, Javascript is a programming language and is treated like an application.

If .css files are set to execute as an application, it will not execute at all and all page formatting will be lost. In most cases you can still login to Skype if you type in your account info, but it will not look pretty.

There is probably a 3rd party program that toggled this setting, possibly a web editor so it could act as a middleman to those files. I would recommend changing it back to the default. If you find you have a program that requires it to be reversed, you can always change it back.

In the attached css.zip files you will find:

fix_css.reg - sets to text (fixes login window formatting by setting it to text)
break_css.reg - sets (breaks login window formatting by setting it to application)

Exit completely out of Skype then double click on the fix_css.reg. If this assignment was the only
thing breaking css, then it should fix the login window. To revert at any time, click on the break_css.reg file

There were design changes in the cached web data that houses the .html, .css, and .js files (%programdata%\apps) in 6.10. I tend to recommend people delete the Apps/login folder, then re-install the latest Skype to ensure the contents of %programdata%\apps are refreshed due to the major changes in that cached content. Just as bad as having the improper .css assignment is not having the correct .css and other related files on the hard drive.

Download

source : http://community.skype.com/t5/Windows-desktop-client/Skype-6-10-0-104-BIG-Login-screen-problem/m-p/2104915/highlight/true#M202212



Thursday, January 23, 2014

cron job

0 1 * * *   /bin/backup.sh
@daily root /bin/code.sh

code.sh

cd /path-to-file
tar -cvf drk-`date +%Y%m%d`.tar.gz  /path-to-file

backup.sh

#!/bin/sh
#backup.sh
ldir=$(mysqldump --routines --single-transaction -u Username -ppassword dbname > /path-to-file/drk_`date +"\%Y\%m\%d\%H\%M\%S"`.sql);

Friday, January 17, 2014

Add Godaddy SSL Certificate with Simple Control Panel

This task seems easy at first but it can become more tricky than what it looks. If you have a godaddy SSL and Simple Control Panel, this will make your life easier.

1. Go to Simple control panel and click on SSL Certificates
2. Click on CSR and fill in the form linking with appropriate domain. Set Key Length to 2048
3. After the record is created, edited and copy the CSR KEY
4. Log in to godaddy control panel.
5. Click on SSL Certificates and enter de SSL Certificate control panel.
6. Choose the desired certificate and click on Key or Re-Key.
7. Paste the CSR key and click next.
8. Download the certificate for Apache.
9. Open the downloaded files and go back to Simple Control Panel.
10. Edit the certificate previously generated.
11. There will be two fields filled up and two empty. Copy/paste the key of the certificate from file you downloaded into the Certificate box.
12. Finally copy the Intermediate Certificates from the gd_bundle file into the Intermediate Certificate box, and click Save.

Thursday, January 16, 2014

Connect to SQL Server Using Oracle SQL Developer

Step 1. Get the JDBC driver for MS SQL : If you don't already have one, download a JDBC driver for MS-SQL. I use the jTDS driver, which is open-source Java. It doesn't matter where you place it, but remember where.

First you need to get the right driver. You can find it here: http://sourceforge.net/projects/jtds/files/jtds/1.2.5/jtds-1.2.5-dist.zip/download
NOTE: For SQL Developer 4.0EA3 and SQL Developer Data Modeler 4.0 (production) you now need jtds-1.3.1. Get it here: http://sourceforge.net/projects/jtds/files/

Step 2. Load the JDBC driver : As explained in Oracle's tutorial, under Preferences, scroll down to Database and Third Party JDBC Drivers. Once you load the jtds-1.2 jar file you should see both SQL Server and it's aging uncle Sybase added to your list of options when creating a new database connection (You get Oracle and Access by default).

Step 3. Set up your new database connection : Now you can create a new MS SQL database connection the same you would an Oracle connection. The only difference is that you need to select the SQLServer tab instead of Oracle. If you don't see that tab, then something went wrong - either you got the wrong jar file or it didn't load correctly.

Wednesday, January 8, 2014

Fix for ‘JFolder::create: Could not create directory’ Error

This error occurs when you move from one host to another host. It is because when we move a Joomla site from one server to another server, the log & tmp functions present in the configuration.php file contains the directory path where you had previously installed Joomla i.e. on the old server.

Unlike other Errors, the fix for this error is pretty Simple. Follow the steps below to fix it.

1) Goto your Hosting panel >> File Manager >> Select your Domain/Sub-Domain and then open the configuration.php file.
2) Find var $log_path, it will contain the Directory path of your Old Server. Just replace the whole line with the code var $log_path = './logs';
3) Find var $tmp_path, it will also have the Directory path of your Old Server. Replace the whole line with the code var $tmp_path = './tmp';

Thursday, January 2, 2014

Install RabbitVCS via PPA

RabbitVCS is a set of graphical tools for accessing the version control software that you use. It supports Subversion and git and is similar to TortoiseVCS found on Windows.

Ubuntu 12.04 provides RabbitVCS in the standard repositories but this is version 0.13 which does not have support for GNOME 3 and so does not provide nautilus integration or gEdit integration.

In order to install the later 0.15 version of RabbitVCS you will need to add the RabbitVCS ppa.

Install RabbitVCS via PPA:

The RabbitVCS PPA supports Ubuntu 13.04, Ubuntu 12.04, Ubuntu 12.10, Ubuntu 11.10, Ubuntu 10.04 and their derivatives, such as Linux Mint and Elementary OS.

Press Ctrl+Alt+T on your keyboard to open terminal. When it opens run commands to add the PPA:

sudo add-apt-repository ppa:rabbitvcs/ppa

Then update system package lists via:

sudo apt-get update

Install the packages:

sudo apt-get install rabbitvcs-nautilus3 rabbitvcs-thunar rabbitvcs-gedit rabbitvcs-cli