繁体   English   中英

内部服务器错误-HTACCESS文件

[英]Internal Server Error - HTACCESS file

我有以下几点:

C:\wamp\www\MyProject

目录结构如下所示:

MyProject
   folder1
   folder2
   index.php
   .htaccess

htaccess文件包含:

# Turn on mod_rewrite handling
RewriteEngine On
# Allows for three wildcards: page, action and id
RewriteRule (.*?)/(.*?)/(.*?)$
index.php?page=$1&action=$2&id=$3

每当我尝试访问http:\\\\127.0.0.1/MyProject/testpage/testaction/testid ,都会出现以下错误:

 Internal Server Error The server encountered an internal error or misconfiguration and was unable tocomplete your request. 

我在这里做错了什么?

您有语法错误。 RewriteRule必须在单行中。

尝试以下规则:

RewriteEngine On
RewriteBase /MyProject/

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# Allows for one wildcard: page
RewriteRule ^([^/]+)/?$ index.php?page=$1 [L,QSA]

# Allows for two wildcards: page, action
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?page=$1&action=$2 [L,QSA]

# Allows for three wildcards: page, action and id
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?page=$1&action=$2&id=$3 [L,QSA]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM