[Drupal] .htaccess issue

本文介绍了一种常见的Apache服务器问题——内部服务器错误的解决方法。通过调整.htaccess文件中的重写规则来修复因配置不当导致的错误,并提供修改前后的对比。

When I insert a wrong url to the server, I got the error as blow :

 

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, administrateur@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


  

 

And then I check the log of apache, I got some notice :

 


  
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

 

 

Thanks for Google, I got the resolve.

 

Open the .htaccess files, we can get some code as below :

 


  
RewriteBase /example
RewriteCond
% {REQUEST_FILENAME} ! -f
RewriteCond
% {REQUEST_FILENAME} !- d
RewriteCond
% {REQUEST_URI} !=/ favicon.ico
RewriteRule ^(.
* ) $ index.php ? q = $1 [L,QSA]

Because the website is running in a subdirectory of the server ( or maybe in a VirtualDocumentRoot and the rewrite rules are not working properly),  after I modify the .htaccess file, I fix the error. Here is the code :

 

ContractedBlock.gif ExpandedBlockStart.gif 代码

   
RewriteBase / example
RewriteCond
% {REQUEST_FILENAME} ! -f
RewriteCond
% {REQUEST_FILENAME} !- d
RewriteCond
% {REQUEST_URI} !=/ favicon.ico
RewriteRule ^(.
* ) $ / index.php ? q = $1 [L,QSA] # add a slash in front of index.php?

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值