문제

나는 오래된 상점을 Magento로 옮겼습니다. 1.9.2 CE 마그토를 사용하여 IM.오래된 가게가 있었고 수년 동안 달리고 SEO URL을 느슨하게하고 싶습니다. 그래서 301 리디렉션을하려고 할 때 문제가 발생합니다.

이전 URL이 INDER.PHP가있는 경우 새 URL로 리디렉션 대신 MAGENTO가 홈페이지로 리디렉션합니다.

제 3 자 확장으로 Magento Default URL Rewrites를 사용 하여이 작업을 수행하고 htaccess로 잘 시도했습니다.항상 같은 결과.

예 :

.htaccess의 코드 다음과 같은 코드

Redirect 301 /index.php?main_page=product_info&products_id=161 http://domain.com/catalogsearch/result/?q=sku-161 --- This redirects to homepage (Doesnt work properly)
Redirect 301 /main_page=product_info&products_id=331 http://domain.com/catalogsearch/result/?q=sku-331 --- This redirects to new URL (Works Properly) 
.

문제는 모든 이전의 모든 URL에 index.php가 있습니까?그것에 나는 어떻게 든 일할 필요가 있습니다.

아이디어가 있습니까?

고맙습니다 :)

도움이 되었습니까?

해결책

.htaccess 파일의 리디렉션 지시문이 쿼리 문자열과 일치하지 않고 요청 URI (물음표 앞에 파트).쿼리 문자열과 일치하려면 Rewritecond 및 Rewriterule 지시문을 사용해야합니다.여기에 대한 추가 정보 : https://simonecarletti.com/blog/2009 / 01 / Apache-Query-String-redirects /

이것은 .htaccess

에서 작동해야합니다

RewriteEngine On

RewriteCond %{QUERY_STRING} ^main_page=product_info&products_id=331$
RewriteRule ^index\.php$ http://gearx.local/catalogsearch/result?q=sku-331 [R=301,L]
.

리디렉션 해야하는 모든 URL이 숫자 ID가있는 동일한 형식으로이 두 줄을 모두 관리해야합니다.

RewriteCond %{QUERY_STRING} ^main_page=product_info&products_id=([0-9]+)$
RewriteRule ^index\.php$ http://gearx.local/catalogsearch/result?q=sku-%1 [R=301,L]
.

검색 결과 페이지가 아닌 제품의 실제 URL로 리디렉션하는 것이 좋습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top