1

我被一个看起来写得很糟糕的网站所困扰。我已将该站点克隆到我的服务器以在安全的环境中进行更改,但似乎无法使用重写规则使子页面呈现。我确实注意到原来的长参数确实渲染了页面,所以我将它缩小到 htaccess 文件,这似乎是规则。这是文件:

RewriteEngine on

RewriteBase /otherpages/

#AddHandler x-httpd-php5-3 .php

RewriteRule ^index.html$ ./index.php [L]
RewriteRule ^contact-us.html$ ./cntc_page.php [L]
RewriteRule ^contact-us-action.html$ ./cntc_page_action.php [L]
RewriteRule ^contact-us-successful.html$ ./cntc_page_success.php [L]

#company list page
#RewriteRule ^category/([^/]*)/([^/]*)/([^/]*).html$ ./company_list.php?category_title=$1&start=$2&order=$3 [L]
RewriteRule ^category/([^/]*)/([^/]*)/([^/]*)/([^/]*).html$ ./company_list.php?category_title=$1&limit=$2&start=$3&order=$4 [L]
RewriteRule ^category/([^/]*)/([^/]*)/([^/]*).html$ ./company_list.php?category_title=$1&limit=$2&start=$3 [L]

RewriteRule ^category/([^/]*)/([^/]*).html$ ./company_list.php?category_title=$1&start=$2 [L]
RewriteRule ^category/([^/]*).html$ ./company_list.php?category_title=$1 [L]
RewriteRule ^category.html$ ./company_list.php [L]
RewriteRule ^sub-category/([^/]*)/([^/]*).html$ ./sub_category_list.php?category_title=$1&start=$2 [L]
RewriteRule ^sub-category/([^/]*).html$ ./sub_category_list.php?category_title=$1 [L]


RewriteRule ^company-list/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*).html$ ./sub_company_list.php?category_title=$1&sub_cat_title=$2&limit=$3&start=$4&order=$5 [L]

RewriteRule ^company-list/([^/]*)/([^/]*)/([^/]*)/([^/]*).html$ ./sub_company_list.php?category_title=$1&sub_cat_title=$2&limit=$3&start=$4 [L]
RewriteRule ^company-list/([^/]*)/([^/]*)/([^/]*).html$ ./sub_company_list.php?category_title=$1&sub_cat_title=$2&limit=$3 [L]
RewriteRule ^company-list/([^/]*)/([^/]*).html$ ./sub_company_list.php?category_title=$1&sub_cat_title=$2 [L]

#detail page
RewriteRule ^company/([^/]*).html$ ./company_detail.php?company_title=$1 [L]

#content pages
RewriteRule ^pages/([^/]*).html$ ./content_page.php?page_title=$1 [L]


#events page
RewriteRule ^events-list/([^/]*)/([^/]*).html$ ./event_list.php?start=$1&sort_ord=$2 [L]
RewriteRule ^events-list/([^/]*).html$ ./event_list.php?start=$1 [L]
RewriteRule ^events-list.html$ ./event_list.php [L]
RewriteRule ^event-details/([^/]*).html$ ./event_detail.php?event_title=$1 [L]

#search page
RewriteRule ^search-company/([^/]*)/([^/]*)/([^/]*).html$ ./search_company.php?search_keyword=$1&start=$2&sort_ord=$3 [L]
RewriteRule ^search-company/([^/]*)/([^/]*).html$ ./search_company.php?search_keyword=$1&start=$2 [L]
RewriteRule ^search-company/([^/]*).html$ ./search_company.php?search_keyword=$1 [L]
RewriteRule ^search-company.html$ ./search_company.php [L]

#search events
RewriteRule ^search-events/([^/]*)/([^/]*)/([^/]*).html$ ./event_search.php?search_keyword=$1&start=$2&sort_ord=$3 [L]
RewriteRule ^search-events/([^/]*)/([^/]*).html$ ./event_search.php?search_keyword=$1&start=$2 [L]
RewriteRule ^search-events/([^/]*).html$ ./event_search.php?search_keyword=$1 [L]
RewriteRule ^search-events.html$ ./event_search.php [L]

#coupons
RewriteRule ^q-perks/([^/]*).html$ ./coupons.php?start=$1 [L]
RewriteRule ^q-perks.html$ ./coupons.php [L]

#printed edition
RewriteRule ^the-printed-edition.html$ ./printed_edition.php [L]
RewriteRule ^the-printed-edition-action.html$ ./printed_edition_action.php [L]
RewriteRule ^the-printed-edition-successful.html$ ./printed_edition_success.php [L]

#print
RewriteRule ^print-page/([^/]*).html$ ./print_page.php?coupon_title=$1 [L]

除了 Rewrite 基础之外,该文件与他们当前服务器上的文件相同,我必须注释掉,AddHandler x-httpd-php5-3 .php因为它会提示我下载站点或某些文件...我知道 mod_rewrite 已打开,其他所有内容都正确配置为我有其他使用重写引擎的站点没有问题。这里还有什么问题?我不熟悉 htaccess 领域和真正的服务器配置。任何帮助是极大的赞赏。

4

1 回答 1

0

大多数 php 文件都在根目录中。

为什么你有:

RewriteBase /otherpages/

如果您的 php 文件在您的文档根目录中?看起来您要重写的所有这些 php 文件都在文档根目录中,因为我可以对链接执行以下操作:http://cvfstrategies.com/company_list.php?category_title=accomodations就好了。将 baee 更改为:

RewriteBase /
于 2013-11-06T18:30:02.030 回答