Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 正在忽略多个重写规则_Php_Regex_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Php 正在忽略多个重写规则

Php 正在忽略多个重写规则,php,regex,apache,.htaccess,mod-rewrite,Php,Regex,Apache,.htaccess,Mod Rewrite,我正在尝试将另一个重写规则添加到我当前的.htaccess中,下面是.htaccess当前的显示方式 Options +FollowSymlinks RewriteEngine on RewriteOptions MaxRedirects=10 AddType "text/html; charset=UTF-8" html AddType "text/plain; charset=UTF-8" txt <IfModule mod_rewrite.c> RewriteE

我正在尝试将另一个重写规则添加到我当前的.htaccess中,下面是.htaccess当前的显示方式

Options +FollowSymlinks 
RewriteEngine on 
RewriteOptions MaxRedirects=10 

AddType "text/html; charset=UTF-8" html 
AddType "text/plain; charset=UTF-8" txt 

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase / 

# if file not exists 
RewriteCond %{REQUEST_FILENAME} !-f 

# if dir not exists 
RewriteCond %{REQUEST_FILENAME} !-d 

# avoid 404s of missing assets in our script 
RewriteCond %{REQUEST_URI} !^.*\.(jpe?g|png|gif|css|js)$ [NC] 

# core framework url rewriting 
RewriteRule .* index.php [QSA]
<IfModule mod_rewrite.c> 

以下是使用新规则保持.htaccess的方法:

Options +FollowSymlinks -MultiViews

AddType "text/html; charset=UTF-8" html 
AddType "text/plain; charset=UTF-8" txt 

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase / 

# API rule
RewriteRule ^api/v1/(.*)$ /myAPI.php?request=$1 [QSA,NC,L]

# if file not exists 
RewriteCond %{REQUEST_FILENAME} !-f
# if dir not exists 
RewriteCond %{REQUEST_FILENAME} !-d 
# avoid 404s of missing assets in our script 
RewriteCond %{REQUEST_URI} !^.*\.(jpe?g|png|gif|css|js)$ [NC] 
# core framework url rewriting 
RewriteRule ^ index.php [L]

<IfModule mod_rewrite.c> 
Options+FollowSymlinks-多视图
AddType“text/html;charset=UTF-8”html
AddType“文本/普通;字符集=UTF-8”txt
重新启动发动机
重写基/
#API规则
重写规则^api/v1/(.*)$/myAPI.php?请求=$1[QSA,NC,L]
#如果文件不存在
重写cond%{REQUEST_FILENAME}-F
#如果目录不存在
重写cond%{REQUEST_FILENAME}-D
#避免脚本中丢失404个资产
重写条件%{REQUEST_URI}!^.*\。(jpe?g | png | gif | css | js)$[NC]
#核心框架url重写
重写规则^index.php[L]

非常感谢,这解决了有史以来最烦人的事情
Options +FollowSymlinks -MultiViews

AddType "text/html; charset=UTF-8" html 
AddType "text/plain; charset=UTF-8" txt 

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase / 

# API rule
RewriteRule ^api/v1/(.*)$ /myAPI.php?request=$1 [QSA,NC,L]

# if file not exists 
RewriteCond %{REQUEST_FILENAME} !-f
# if dir not exists 
RewriteCond %{REQUEST_FILENAME} !-d 
# avoid 404s of missing assets in our script 
RewriteCond %{REQUEST_URI} !^.*\.(jpe?g|png|gif|css|js)$ [NC] 
# core framework url rewriting 
RewriteRule ^ index.php [L]

<IfModule mod_rewrite.c>