Monthly Archives: July 2014

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: ,

Efficient Way to handle deep paging in Solr 4.7

Efficient Way to handle deep paging in Solr 4.7

One thing Solr has never been very efficient at is a problem that people refer to as “Deep Paging”. What is the Deep Paging?

What is Deep Paging:
Imagine the following problem – we have an application that expects Solr to return the results sorted on the basis of some field or Score. Those results will be than paged in the GUI.

However, if the person using the GUI application immediately selects the tenth, twentieth, or fiftieth page of search results there is a problem – the wait time because Solr need to lot of work for it.

Continue reading

Category: Technology | Tags: ,

Rail Budget: Not a single thing for Udaipur (Mewar)

Rail Budget: Not a single thing for Udaipur (Mewar)

Udaipur Railway Station

Udaipur City

Nobody mention of Udaipur-Ahmadabad gauge conversion

Rail Ministry, which had been a highly politicized department of the Central Government for past couple of decades, presented its Indian rail budget today. It was bound to be a complex situation for the Rail Minister Sadananda gowda not only because this particular department had always been with collaborative parties and condition of Indian Railways is very poor.

Continue reading

Category: Thoughts | Tags: ,