将api / request重定向到api.php以及对index.php的所有其他请求

时间:2015-11-08 12:32:20

标签: .htaccess redirect

为现有应用程序构建api,将所有请求重定向到index.php。但是现在我想用api将所有请求指向api.php,例如将http://domain.com/api/user/create重定向到api.php和其他请求,而无需api,例如www.domain.com/users/all到index.php 这是我的htaccess



Options -Indexes

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/font-woff .woff
AddType image/svg+xml svg
AddType image/svg+xml svgz


<IfModule mod_rewrite.c>
    #Fix Rewrite
    Options -Multiviews
    RewriteEngine On
    #Live version goes here
    #RewriteBase /

    #Dev config goes here
    RewriteBase /myapp



    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*,:*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^var.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    ## always send 404 on missing files in these folders
    RewriteCond %{REQUEST_URI} !^/(media|theme|js|screens)/

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
  

</IfModule>

<IfModule !mod_rewrite.c>
   
    ErrorDocument 404 /index.php
</IfModule>
&#13;
&#13;
&#13;

0 个答案:

没有答案