2

現在の .htaccess に別のRewriteRuleを追加しようとしています。現在の .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> 

RewriteRule .* index.php次に、まだ完全に無視される前に次を追加しようとしました

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

1 に答える 1

1

これは、新しいルールで .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> 
于 2013-11-05T07:09:11.100 に答える