How to stop site directory listing

If you create a folder in your site then don’t forget to put “index.html” file there, otherwise site visitor can see complete directory listing of all files and folders of that folder.

How to prevent

In .htaccess file in your site root directory , add the following line.

Options -Indexes

It will prevent visitors from directory listing of folders.

Advertisements

Redirect from one website url to another url

You can redirect website url to another url using .htaccess file. write following code into .htaccess file and put this file into root folder of your old website. This code is tested at apache server on linux hosting.

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