简体   繁体   中英

I want to redirect from root path /index.php to index.php?page=terms

I am making changes in .htaccess file to change root path (/) to index.php?page=terms

Redirect /index.php /index.php?page=terms

but it shows error redirect too many times

Have you tried changing the name of the index page? For instance, redirecting from index.php to home.php?page=terms The page might be redirecting ALL index.php pages (including the index.php?page=terms ) since it is, after all, the same page just with a little bit of GET info in the URL.

Alternatively, you might want to just use something like:

    if(!isset($_GET["page"])){
      header("Location: index.php?page=terms");
    }

which will redirect if the ?page= isn't there. This doesn't require any .htaccess changes.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM