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 {} \;