Reputation: 2935
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
Upvotes: 1
Views: 89
Reputation: 785521
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]
Upvotes: 1
Reputation: 3631
May be just
RewriteRule ^(.*)$ /main-page [L]
Or with the [R] flag to force redirect :
RewriteRule ^(.*)$ /main-page [R]
Upvotes: 1