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
May be just
RewriteRule ^(.*)$ /main-page [L]
Or with the [R] flag to force redirect :
RewriteRule ^(.*)$ /main-page [R]
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]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.