dqr3883 2015-01-06 09:22
浏览 142
已采纳

.htaccess:RewriteBase接受一个参数,即每个目录上下文的基本URL

I am getting Internal server error due to .htaccess.

My code is below

RewriteEngine on

RewriteBase /

# Prevent CI index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 

# Prevent user access to the CI system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L] 

# Prevent user access to the CI application folder
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

and error_log file show]

/home/adonwayc/public_html/billing/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context
[Tue Jan 06 14:43:58.213270 2015] [core:alert] [pid 642720] [client 122.177.194.19:60610] /home/adonwayc/public_html/billing/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context
[Tue Jan 06 14:39:28.780669 2015] [core:alert] [pid 583314] [client 122.177.194.19:57750] /home/adonwayc/public_html/billing/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context
[Tue Jan 06 14:39:28.780603 2015] [core:alert] [pid 583314] [client 122.177.194.19:57750] /home/adonwayc/public_html/billing/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context
  • 写回答

1条回答 默认 最新

  • dt3358 2015-01-06 12:14
    关注

    /home/adonwayc/public_html/billing/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context

    Looking at the logs, your htaccess seems to be located in billing subfolder.
    Your RewriteBase should then be /billing/.

    Also, REQUEST_URI begins with a leading slash /.
    Here is a corrected version of your htaccess

    RewriteEngine on
    RewriteBase /billing/
    
    RewriteCond %{REQUEST_URI} ^/(?:system|application) [NC]
    RewriteRule ^(.*)$ index.php?/$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L] 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 数字信号处理实验报告
  • ¥15 ensp路由器启动不了一直报#
  • ¥50 安卓10如何在没有root权限的情况下设置开机自动启动指定app?
  • ¥15 ats2837 spi2从机的代码
  • ¥200 wsl2 vllm qwen1.5部署问题
  • ¥100 有偿求数字经济对经贸的影响机制的一个数学模型,弄不出来已经快要碎掉了
  • ¥15 数学建模数学建模需要
  • ¥15 已知许多点位,想通过高斯分布来随机选择固定数量的点位怎么改
  • ¥20 nao机器人语音识别问题
  • ¥15 怎么生成确定数目的泊松点过程