开发者

How to exclude api.php from the default routing in htaccess

开发者 https://www.devze.com 2023-03-03 22:30 出处:网络
I use the default .httaccess provided by Zend. I have another route defined in my apache configs so that everything submitted to /api.php/WHATEVER is being routed to another framework.

I use the default .httaccess provided by Zend. I have another route defined in my apache configs so that everything submitted to /api.php/WHATEVER is being routed to another framework.

If I add the default routes into the .htaccess file, this rule is being overwritten. What I tried to do to disable the rewrite engine was the following:

RewriteEngine On
# api.php
RewriteCond %{REQUEST_URI} !^/(api\.php/.*)$
# Existing file
RewriteCond %{REQUEST_FILENAME} -s [OR]
# Existing directory
RewriteCond %{REQUEST_FILENAME} -l [OR]
# Symbolic link
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - 开发者_运维问答[NC,L]
RewriteRule ^.*$ index.php [NC,L]

Unfortunately, I don't see the error. Thanks for your help.


Maybe this should work :

RewriteEngine On
# api.php
RewriteCond %{REQUEST_URI} ^/(api\.php/.*)$
RewriteRule  api.php?(.*) [R=301,L]
# Existing file
RewriteCond %{REQUEST_FILENAME} -s [OR]
# Existing directory
RewriteCond %{REQUEST_FILENAME} -l [OR]
# Symbolic link
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

but you may adapt...

0

精彩评论

暂无评论...
验证码 换一张
取 消