.htaccess文件无效

RewriteEngine on
RewriteCond $1 !^(index\.php|img|css|gallary|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Above is the code exist in .htaccess.

I want the rules such as every request made to main domain or subdomain must hit the index,php file in the domain root.

exm. api.xyz.com, api.xyz.com/register, api.xyz.com/login all this request must have to go to index.php

I am facing this error on ipage web host. Please suggest if anything wrong the host too.

Try this rule:

DirectoryIndex index.php
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php/$1 [L]