Change default directory page
Most probably you have been wondering how the Webserver decides which page from your site to use as a main/default page of your site. There is a directive named DirectoryIndex which takes care of this.
On most web servers there is a pre-defined set of file names which server a start page.
The most commonly used are: index.html, default.html, index.php, index.asp, etc.
The good news is that you can set your custom file to be a start page of your site using .htaccess.
For example the following line set home-page.html as a main page of your site:
DirectoryIndex home-page.html
The DirectoryIndex directive can accept more than one name:
DirectoryIndex home-page.html Home.html, index.html index.php index.cgi
So when a visitors goes to http://www.example.com the first page to be loaded will be the home-page.html if it cannot be found the server will look then for Home.html, index.html, etc until it finds a match.
- How to block users from accessing your site based on their IP address
- How to prevent or allow directory listing?
- How to change the error documents – 404 Page Not Found, etc
- Using .htaccess for password protecting your folders
- Using .htaccess to block referrer spam
- Disable Hot-Linking of images and other files
- Redirect URLs using .htaccess
- Introduction to mod_rewrite and some basic examples
- Force SSL/https using .htaccess and mod_rewrite
- 301 Permanent redirects for parked domain names
- Enable CGI, SSI with .htaccess
- How to add Mime-Types using .htaccess
- Change default directory page
- Block Bad robots, spiders, crawlers and harvesters
- Make PHP to work in your HTML files with .htacess
- Change PHP variables using .htaccess
- HTTP Authentication with PHP running as CGI/SuExec
- Force www vs non-www to avoid duplicate content on Google
- Duplicate content fix index.html vs / (slash only)
Comments 5 >>
How to set the default page please explain
How do I use the htaccess so that any request for a page that no longer exists will redirect to the index so that my links are counted.
Thanks
You can try:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !jpg|jpeg|gif|css|js|png [NC]
RewriteRule . /index.php [L]
| Previous: How to add Mime-Types using .htaccess | Next: Block Bad robots, spiders, crawlers and harvesters |

Regards