使用.htaccess文件配置web服务器


web server configuration using .htaccess file

当我尝试使用.htaccess实现web服务器配置时,它不会将我重定向到指向的文件。我在httpd.conf中更改了"AllowOverride:All",并检查mod重写模块是否已启用。但当我尝试URL"localhost/student-portal/student"时,它会抛出如下错误:

  **Internal Server Error** 
  The server encountered an internal error or misconfiguration and was unable to complete 
  your request. Please contact the server administrator at admin@example.com to inform them 
  of the time this error occurred, and the actions you performed just before this error. 
  More information about this error may be available in the server error log.

.htaccess文件片段

 RewriteEngine on 
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-l
 RewriteRule ^(.*)$ index.php?url=$1 [QSA, L]

index.php

<?php
    $url = $_GET['url'];
    echo '"'.$url.'"'.'is the requested page';
?>

这是我的error.log文件:

〔2015年12月4日星期五13:51:17.923527〕〔核心:警报〕〔pid 4796:tid 1172〕〔客户端::1:52258〕C:''/Bitnami/wampstack-5.530/0/apache2/htdocs/学生门户/.htaccess:RewriteRule:错误的标志分隔符

标志不允许中有空间

更改

RewriteRule ^(.*)$ index.php?url=$1 [QSA, L]

RewriteRule (.*) index.php?url=$1 [QSA,L]

^平均起始带的$平均端

因此,当你使用.*时,这意味着它们不需要