我被困在一个看起来很糟糕的网站上。我已将网站克隆到我的服务器以在安全的环境中进行更改,但似乎无法使用重写规则来呈现子页面。我注意到原来的long参数确实渲染了页面,所以我把它缩小到了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 base之外,这个文件与当前服务器上的文件相同,我必须注释掉AddHandler x-httpd-php5-3 .php
,因为它会提示我下载网站或某个文件......我知道mod_rewrite已经被转换on和其他所有配置正确,因为我有其他网站使用重写引擎没有问题。还有什么可能是错的?我不熟悉htaccess竞技场和真正的服务器配置。任何帮助是极大的赞赏。
答案 0 :(得分:0)
大多数php文件都在根目录中。
为什么你有:
RewriteBase /otherpages/
如果您的php文件在您的文档根目录中?看起来你正在重写的所有这些php文件都在文档根目录中,就像我对http://cvfstrategies.com/company_list.php?category_title=accomodations
之类的链接一样。将baee更改为:
RewriteBase /