2014-09-23 80 views
0

我有一個Frog CMS的問題,它是我第一次使用這個CMS,是一個使用這個的客戶端。青蛙CMS htaccess診斷

場景:我使用名爲「Redirector」的插件修改了1個重定向,這個插件破壞了整個站點!

幸運的是,我發現一個幾個月前的htaccess,允許網站工作,但重定向沒有他們的作品,網站的作品,但不是重定向,網站的主要網址重寫似乎是好的,但我需要301重定向,不工作。

我無法弄清楚爲什麼會發生這種情況,爲什麼這個重定向不能正常工作,他們沒有衝突,但他們什麼都不做!你能對此提出建議嗎?我期待着更多關於URL重寫和htaccess的瞭解。

我不能使用插件來生成重定向,因爲它摧毀了整個網站。如果有一種方法來「重置」網址在這個CMS重寫,這將是好的,但我沒有合作形式的網站的開發者...

我感謝任何幫助,以更好地瞭解什麼是錯的,爲什麼全部

RewriteRule ^site/services/immigration/ /services/immigration.html [L,R=301] 

不工作!

### CMS-Generated Update August 1, 2013, 1:45 pm ### 

# 
# Setting Frog requirements 
# 
AddType text/x-component .htc 
AddType video/ogg .ogm 
AddType video/ogg .ogv 
AddType video/ogg .ogg 
AddType video/webm .webm 
AddType video/mp4 .mp4 
AddType video/x-m4v .m4v 
AddType audio/webm .weba 
AddDefaultCharset UTF-8 
Options -Indexes -MultiViews +FollowSymLinks 
DirectoryIndex index.html index.php 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteCond %{HTTP_HOST} !.local$ [NC] 
RewriteCond %{HTTP_HOST} !.local$ [NC] 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 
RewriteRule ^install/index.html$ install/index.php?rewrite=1 [L,QSA] 
RewriteRule ^install/index.php$ install/index.php?rewrite=1 [L,QSA] 
RewriteRule ^install/$ install/index.php?rewrite=1 [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^admin(.*)$ admin/index.php?$1 [L,QSA] 
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f 
RewriteRule ^$ /cache/index.html [L,QSA] 
RewriteCond %{REQUEST_METHOD} ^GET$ 
RewriteCond %{DOCUMENT_ROOT}/cache/%{REQUEST_URI} -f 
RewriteRule ^(.*)$ /cache/$1 [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^download/(.*)$ /downloads.php?THISPAGE=download.html&media=pdf&filename=$1 [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^private/(.*)$ /private.html?THISPAGE=private.html&userfile=$1 [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^mobile/search/(.*)$ mobile.html?THISPAGE=search.html&media=mobile&search=$1 [L,QSA] 
#RewriteCond %{REQUEST_FILENAME} !-f 
#RewriteCond %{REQUEST_FILENAME} !-d 
#RewriteCond %{REQUEST_FILENAME} !-l 
#RewriteRule ^mobile/(.*)/process.html$ mobile.html?THISPAGE=$1&media=mobile&return=process [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^mobile/(.*)/success.html$ mobile.html?THISPAGE=$1&media=mobile&return=success [L,QSA] 
#RewriteCond %{REQUEST_FILENAME} !-f 
#RewriteCond %{REQUEST_FILENAME} !-d 
#RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^standard/search/(.*)$ standard.html?THISPAGE=search.html&media=standard&search=$1 [L,QSA] 
#RewriteCond %{REQUEST_FILENAME} !-f 
#RewriteCond %{REQUEST_FILENAME} !-d 
#RewriteCond %{REQUEST_FILENAME} !-l 
#RewriteRule ^standard/(.*)/process.html$ standard.html?THISPAGE=$1&media=standard&return=process [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^standard/(.*)/success.html$ standard.html?THISPAGE=$1&media=standard&return=success [L,QSA] 
#RewriteCond %{REQUEST_FILENAME} !-f 
#RewriteCond %{REQUEST_FILENAME} !-d 
#RewriteCond %{REQUEST_FILENAME} !-l 
#RewriteRule ^(.*)/process.html$ contact.html?THISPAGE=$1&return=process [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^(.*)/success.html$ contact.html?THISPAGE=$1&return=success [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^search/(.*)$ index.php?THISPAGE=search.html&search=$1 [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^proposal.html$ index.php?THISPAGE=$1&media=proposal [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^contrast/search/(.*)$ contrast.html?THISPAGE=search.html&search=$1&media=contrast [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^print/search/(.*)$ print.html?THISPAGE=search.html&search=$1&media=print [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^mobile/(.*)$ mobile.html?THISPAGE=$1&media=mobile [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^standard/(.*)$ standard.html?THISPAGE=$1&media=standard [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^print/(.*)$ print.html?THISPAGE=$1&media=print [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^pdf/(.*)$ pdf.html?THISPAGE=$1&media=pdf [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^proposal/(.*)$ proposal.html?THISPAGE=$1&media=proposal [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^flash/(.*)$ flash.html?THISPAGE=$1&media=flash [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^contrast/(.*)$ contrast.html?THISPAGE=$1&media=contrast [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^(.*)$ index.php?THISPAGE=$1 [L,QSA] 
RewriteRule ^/site/aboutus/(.*)$ /$1 [L,R=301] 
RewriteRule ^site/aboutus//[L,R=301] 
RewriteRule ^pages/about_us.htm /about.html [L,R=301] 
RewriteRule ^site/contact/ /contact.html [L,R=301] 
RewriteRule ^site/library/ /resources.html [L,R=301] 
RewriteRule ^site/services/ /services.html [L,R=301] 
RewriteRule ^site/services/alternative_dispute_resolution/ /services/alternative-dispute-resolution.html [L,R=301] 
RewriteRule ^site/services/business_visas/ /services/business-visas.html [L,R=301] 
RewriteRule ^site/services/civil_comm_litigation/ /services/civil-commercial-litigation-copy.html [L,R=301] 
RewriteRule ^site/services/clinical_negligence/ /services/clinical-negligence.html [L,R=301] 
RewriteRule ^site/services/conveyancing/commercial/ /services/commercial-conveyancing.html [L,R=301] 
RewriteRule ^site/services/company_law/ /services/company-law.html [L,R=301] 
RewriteRule ^site/services/criminal_law/ /services/criminal-law.html [L,R=301] 
RewriteRule ^site/services/divorce_matrimonial/ /services/divorce-matrimonial.html [L,R=301] 
RewriteRule ^site/services/employment_law/ /services/employment-law.html [L,R=301] 
RewriteRule ^site/services/human_rights/ /services/human-rights-issues.html [L,R=301] 
RewriteRule ^site/services/immigration/ /services/immigration.html [L,R=301] 
RewriteRule ^site/services/leases_tenancy/ /services/leases-tenancy-agreements.html [L,R=301] 
RewriteRule ^site/services/injury_medical_negligence/ /services/personal-injury-medical-negligence.html [L,R=301] 
RewriteRule ^site/services/pro_bono/ /services/pro-bono.html [L,R=301] 
RewriteRule ^site/services/conveyancing/ /services/residential-conveyancing.html [L,R=301] 
RewriteRule ^site/services/conveyancing/residential/ /services/residential-conveyancing.html [L,R=301] 
RewriteRule ^site/services/wills_trusts_probates/ /services/wills-trusts-probates.html [L,R=301] 
RewriteRule ^site/people/ /team.html [L,R=301] 
</IfModule> 

回答

0

這是因爲你之前有這樣的規則所有其他服務的重定向規則:

RewriteRule ^site/services/ /services.html [L,R=301] 

這是在說,「任何開始與/site/services/被重定向到/services.html」。所以,當你有這樣一個規則:

RewriteRule ^site/services/company_law/ /services/company-law.html [L,R=301] 

,第二條規則將永遠不會得到執行,因爲第二規則匹配/site/services/company_law/site/services/開始,從而匹配的第一個規則。您需要對所有規則重新排序,以便更一般的規則結束。只要把

RewriteRule ^site/services/ /services.html [L,R=301] 

規則在最底部。

+0

感謝您的幫助jon,這對我來說很好理解。但由於某種原因,沒有重定向工作。當我嘗試在瀏覽器中打開時,它們都會給出404錯誤。 – maha2 2014-09-24 08:34:29

+0

@glowzar你有mod_rewrite加載? – 2014-09-24 13:20:18