Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 在克隆到新服务器后重写不起作用的规则_.htaccess - Fatal编程技术网

.htaccess 在克隆到新服务器后重写不起作用的规则

.htaccess 在克隆到新服务器后重写不起作用的规则,.htaccess,.htaccess,我被一个似乎写得很差的网站困住了。我已经将站点克隆到我的服务器上,以便在安全的环境中进行更改,但似乎无法使用重写规则来呈现子页面。我注意到原来的long参数确实呈现了页面,所以我将其缩小到htaccess文件,这似乎是规则。文件如下: RewriteEngine on RewriteBase /otherpages/ #AddHandler x-httpd-php5-3 .php RewriteRule ^index.html$ ./index.php [L] RewriteRule ^c

我被一个似乎写得很差的网站困住了。我已经将站点克隆到我的服务器上,以便在安全的环境中进行更改,但似乎无法使用重写规则来呈现子页面。我注意到原来的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]
除了重写库之外,这个文件与他们当前服务器上的文件相同,我必须注释掉
AddHandler x-httpd-php5-3.php
,因为它会提示我下载站点或某些文件。。。我知道mod_rewrite已打开,其他所有配置都正确,因为我有其他网站正在使用重写引擎,没有问题。这里还有什么问题吗?我对htaccess领域不太熟悉,实际上我不熟悉服务器配置。非常感谢您的帮助

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

你为什么有:

RewriteBase /otherpages/
如果您的php文件位于文档根目录中?看起来您要重写的所有php文件都在文档根目录中,就像我可以对链接所做的那样:
http://cvfstrategies.com/company_list.php?category_title=accomodations
很好。将baee更改为:

RewriteBase /

您尝试访问哪个失败的URL,php文件位于哪里(在
/otherpages/
目录中?),您可以在此处查看该网站:cvfstrategies.com大多数php文件都在根目录中。整个目录结构很混乱,我对它一无所知。您将看到url确实作为重写的url加载,但我得到了一个404.Wow。我觉得自己像个白痴这以前不起作用…\n谢谢