Tags » Htaccess

Change the current document root to a new directory inside the current one using .htaccess

The scenario is as follows. Client is having a website mydomain.com which is the primary domain of the cpanel account. Now the user want to redirect all the traffic coming to the current document root (/home/username/public_html) to the new_folder created (/home/username/public_html/new_folder/) for the site. 152 more words


Redirect images (other media) content to live production site

During some redesign projects it’s handy to have the images (other media) rendered, but sometimes it could be a struggle to download from specific paths. 30 more words


Apache SetEnvIf logical OR / AND

Apache SetEnvIf module doesn’t support logical conditions, like OR & AND.

To emulate a SetEnvIf logical AND:

CustomLog /var/log/apache2/loopback_posts.log combined env=posting_myself
SetEnvIf Remote_Addr "^" loopback_ip=0
SetEnvIf Remote_Addr "^127\.0\.0\.1$" loopback_ip=1
SetEnvIf Request_Method "POST" posting_myself
SetEnvIf loopback_ip 0 !posting_myself
… 30 more words

Custom Error_404 Page with htaccess

This will show an error message to the visitors when they request a page that doesn’t exist on the server.Normally hosting servers will typically generate a default “404 Not Found” web page when a user attempts to follow a unavailable link. 66 more words


Disable folder listing in your website

Folder listing is an avoidable danger, which you do not want to have in your website. Malicious guys can get access to sensitive information – and you’re dead, Jim! 63 more words

Unix Shell

Input file not specified htaccess

Options -MultiViews

RewriteEngine On
RewriteBase /pardeep/lara/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule .* index.php?/$0


Enabling gzip compression

Almost any serious website you care to check has gzip compression enabled, and this typically cuts bandwidth by upwards of 70%. So if you’re not using it, you very likely should be. 412 more words