我創造了我在我的服務器需要一個.htaccess文件:的.htaccess範圍的RewriteCond
<IfModule mod_rewrite.c>
#Enable the Rewrite Engine
RewriteEngine On
#Rewrite the base to/if this is not local host
RewriteBase/
#Set the base in case of local development
RewriteCond %{HTTP_HOST} ^(.*)localhost(.*)$
RewriteBase /~asafnevo/api
#Redirect every request to the index.php
RewriteRule ^(.*)$ api/index.php?request=$1 [QSA,NC]
# Prevent direct access to access to the index.php
RewriteCond %{THE_REQUEST} index\.php
RewriteRule ^(.*)index\.php$ - [F]
</IfModule>
我加了:
#Set the base in case of local development
RewriteCond %{HTTP_HOST} ^(.*)localhost(.*)$
RewriteBase /~asafnevo/api
,才能在我的本地主機有不同的基開發環境,但我的問題是RewriteCond何時結束?
我試圖做
RewriteBase /~asafnevo/api [L]
但是我收到一個500錯誤。
請問有人可以在RewriteCond的範圍內花費範圍嗎?
看看服務器的錯誤日誌瞭解有關500的詳細信息。 –
@anubhava請問您應該花費多少時間來完成它? –
看起來你已經接受了答案,很高興爲你解決了問題。 – anubhava