Apache mod_rewrite不适用于apache 2.2.31版

时间:2016-05-30 18:35:29

标签: apache .htaccess mod-rewrite

我的Apache版本是2.2.31。

为什么以下htaccess无效,但它在Apache 2.4版中有效?

RewriteEngine On
Options +FollowSymLinks
Options -Indexes
Options -MultiViews

RewriteBase /
RewriteRule ^admin - [L,NC]
RewriteRule ^author - [L,NC]
RewriteRule ^install - [L,NC]

RewriteRule ^page/([^/]*)\.html$ /page.php?permalink=$1 [L]

RewriteRule ^top-phones/$ /top-phones.php [L]
RewriteRule ^phones/$ /phones.php [L]

RewriteRule ^news/$ /news.php [L]
RewriteRule ^news/([^_]*)/$ /news.php?pagenum=$1 [L]

RewriteRule ^reviews/$ /reviews.php [L]
RewriteRule ^reviews/([^_]*)/$ /reviews.php?pagenum=$1 [L]

RewriteRule ^prices/$ /prices.php [L]
RewriteRule ^prices/([^_]*)/$ /prices.php?pagenum=$1 [L]

RewriteRule ^contact/$ /contact.php [L]
RewriteRule ^compare/$ /compare.php [L]

RewriteRule ^compare/([^_]*)/([^_]*)\.html$ /compare-result.php?first=$1&second=$2 [L]

RewriteRule ^([^/]*)/$ /brand.php?brand=$1 [L]
RewriteRule ^([^/]*)/([^_]*)/$ /brand.php?brand=$1&pagenum=$2 

RewriteRule ^reviews/([^_]*)_([^_]*)\.html$ /review-details.php?review_permalink=$1&review_id=$2 [L]
RewriteRule ^reviews/([^_]*)_([^_]*)/([^_]*)/$ /review-page-details.php?review_permalink=$1&review_id=$2&page_permalink=$3 [L]

RewriteRule ^news/([^_]*)_([^_]*)\.html$ /news-details.php?news_permalink=$1&news_id=$2 [L]

RewriteRule ^tag/([^_]*)\.html$ /search.php?search=$1 [L]

RewriteRule ^devices/([^_]*)/([0-9]+)\.html$ /devices.php?permalink=$1&pagenum=$2 [L]

RewriteRule ^devices/([^_]*)\.html$ /devices.php?permalink=$1 [L]

RewriteRule ^([^/]*)/([^_]*)\.html$ /phone-details.php?brand_permalink=$1&phone_permalink=$2 [L]    

ErrorDocument 404 /index.php 

Order Deny,Allow
Deny from 76.164.234.170
Deny from 27.159.235.19
Deny from 76.164.228.218

0 个答案:

没有答案