2013-10-28 110 views
1

我在apache 2.4.4中找不到mod_rewrite.c;但我已启用mod_rewrite。是否需要运行以下.htaccess文件,因为我收到错误500内部服务器错误。在Apache 2.4.4中找不到mod_rewrite.c 2.4.4

<IfModule mod_rewrite.c> 
# Enable mod_rewrite 
RewriteEngine On 
# Specify the folder in which the application resides. 
# Use/if the application is in the root. 
RewriteBase /phpcs5 
# Rewrite to correct domain to avoid canonicalization problems 
# RewriteCond %{HTTP_HOST} !^www\.example\.com 
# RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] 
# Rewrite URLs ending in /index.php or /index.html to/
RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php|html?)\ HTTP 
RewriteRule ^(.*)index\.(php|html?)$ $1 [R=301,L] 
# Rewrite category pages 
RewriteRule ^.*-d([0-9]+)/.*-c([0-9]+)/page-([0-9]+)/?$ index.php?Depart 
mentId=$1&CategoryId=$2&Page=$3 [L] 
RewriteRule ^.*-d([0-9]+)/.*-c([0-9]+)/?$ index.php?DepartmentId=$1&Cate 
goryId=$2 [L] 
# Rewrite department pages 
RewriteRule ^.*-d([0-9]+)/page-([0-9]+)/?$ index.php?DepartmentId=$1&Pag 
e=$2 [L] 
RewriteRule ^.*-d([0-9]+)/?$ index.php?DepartmentId=$1 [L] 
# Rewrite subpages of the home page 
RewriteRule ^page-([0-9]+)/?$ index.php?Page=$1 [L] 
# Rewrite product details pages 
RewriteRule ^.*-p([0-9]+)/?$ index.php?ProductId=$1 [L] 
</IfModule> 

回答

0

那么,对于一件事,你得吨流浪换行的,这将100%的原因500服务器错误:

<IfModule mod_rewrite.c> 
# Enable mod_rewrite 
RewriteEngine On 
# Specify the folder in which the application resides. 
# Use/if the application is in the root. 
RewriteBase /phpcs5 
# Rewrite to correct domain to avoid canonicalization problems 
# RewriteCond %{HTTP_HOST} !^www\.example\.com 
# RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] 
# Rewrite URLs ending in /index.php or /index.html to/
RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php|html?)\ HTTP 
RewriteRule ^(.*)index\.(php|html?)$ $1 [R=301,L] 
# Rewrite category pages 
RewriteRule ^.*-d([0-9]+)/.*-c([0-9]+)/page-([0-9]+)/?$ index.php?DepartmentId=$1&CategoryId=$2&Page=$3 [L] 
RewriteRule ^.*-d([0-9]+)/.*-c([0-9]+)/?$ index.php?DepartmentId=$1&CategoryId=$2 [L] 
# Rewrite department pages 
RewriteRule ^.*-d([0-9]+)/page-([0-9]+)/?$ index.php?DepartmentId=$1&Page=$2 [L] 
RewriteRule ^.*-d([0-9]+)/?$ index.php?DepartmentId=$1 [L] 
# Rewrite subpages of the home page 
RewriteRule ^page-([0-9]+)/?$ index.php?Page=$1 [L] 
# Rewrite product details pages 
RewriteRule ^.*-p([0-9]+)/?$ index.php?ProductId=$1 [L] 
</IfModule>