.htaccess redirect to root to link not working

Think my domain is www.example.com, I want to redirect visitor to www.example.com/main-page . To do that I have written this .htaccess code but its doesn't work.

<IfModule mod_rewrite.c>
RewriteEngine On
    RewriteEngine On
    RewriteRule ^(.*)$/ /main-page/$1 [L]
</IfModule>

Could any one please help me, I can't find the error

Answers


To redirect just the home page you will need this rule:

RewriteRule ^/?$ /main-page [L,R=301]

If you don't want URL to change then use:

RewriteRule ^/?$ /main-page [L]

May be just

RewriteRule ^(.*)$ /main-page [L]

Or with the [R] flag to force redirect :

RewriteRule ^(.*)$ /main-page [R]

Need Your Help

could not find framework in eclipse RCP application

eclipse-rcp

I have developed one eclipse RCP application which I am calling from my own Java program.

Prolog - execute from command line, load multiple files, execute query, exit

command-line prolog multiple-files

I want to run a prolog file (Load.pl) from a Windows command line, executing a query (that outputs its result to a file) and exit.