HostOnNet Blog

Tag Archives: htaccess

Apache Limit Access to a folder

I was working on a site that have “cache” folder inside DocumentRoot of Apache. Since this is a cache folder used by the PHP application, it need to be writable by apache user. We need to prevent access to this


Enable htaccess in Apache

To verify mod_rewrite is enabled in your Apache server, run On CentOS On Debian/Ubuntu If the command shows “rewrite_module”, you have rewrite module enabled on your Apache server. On CentOS servers, rewrite module is enabled by default. On Ubuntu/Debian, you


Redirect OLD domain to NEW using .htaccess

When you move your web site form one domain to another, you need to redirect all visitors on your old domain to new one to avoid lose of traffic. Google recommend using 301 redirect when you change URL of a


How to Change Document Root of Website Using .htaccess

By default the document root of website on a cPanel server is /home/username/public_html . At the time anyone search a domain from there own end the site displays the index page from default location. That means from public_html folder. Here


301 Permanet redirection using .htaccess

301 redirect is a permanent redirect from one URL to the other. This is the cleanest way to redirect a URL. Quick, easy, and search-engine friendly. Remember htaccess stuff is for Apache servers only. You can use following code to


Enable Apache Mode Rewrite in ubuntu

You need to run “a2enmod rewrite” to enable apache mod_rewrite. hon@hon-desktop:~/web$ sudo a2enmod rewrite Module rewrite already enabled hon@hon-desktop:~/web$ In my case it was already enabled, still .htaccess was not working. It was the default site, so i need to