U
U
urajo2022-03-18 11:15:23
htaccess
urajo, 2022-03-18 11:15:23

Redirect from index.php and index.html to normal page?

I'm trying to add a redirect from the index to the regular one, but now when I go to the index, it says Page is not available, advise how to fix it?

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
     
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    
    RewriteCond %{THE_REQUEST} //
    RewriteRule .* /$0 [R=301,L]
    
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html|htm)\ HTTP/ 
    RewriteRule ^(.*)index\.(php|html|htm)$ https://%{HTTP_HOST}%$1 [R=301,L]
</IfModule>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2022-03-18
@urajo

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Need to add[R=301,L]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteRule ^(.*)index\.(php|html|htm)$ https://%{HTTP_HOST}%$1 [R=301,L]

There is an error in %$1
Must be replaced with /or/$1
RewriteRule ^(.*)index\.(php|html|htm)$ https://%{HTTP_HOST}/ [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question