C
C
Carlyndow Marlifi2021-07-23 21:08:01
htaccess
Carlyndow Marlifi, 2021-07-23 21:08:01

How to make this PHP code only with .htaccess?

$url = $_SERVER['REQUEST_URI'];
if($url == '/index.html' OR $url == '/index.php'){
  header('location: /');
}

Is it possible to implement this with just a plug?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Danchenko, 2021-07-23
@petushok55

RewriteRule ^(.*)index\.(php|html?)$ /$1 [R=301,NC,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question