내 요구 사항은 Wordpress의 기존 사이트에 대한 SEO Friendly URL을 수행하는 것입니다. 예를 들어add_rewrite_rule 대신 Apache Fallback
,
Current URL: http://localhost/test/?pid=19971
that is the page "test" is rendering the data from some custom plugin.
My new SEO URL : http://localhost/brand/sub_category/product_name
Here, Brand, Sub_category and product_name is fetched from the pid..
내가 functions.php에서 다음 다시 쓰기 규칙을 사용하여 데이터를 채우는하고,이 코드에서
add_rewrite_rule(MY_DYNAMICALLY_POPULATED_URL.'$ page-test.php?brand='.$brand_name.'&sub='.$sub_category.'&pname='.$product_name.' [L]', 'top');
의 page-test.php
은 루트 디렉토리와에 위치 brand_name
, sub_category
및 productname
을 전달하여 해당 파일에서 데이터를 렌더링하면 pid을 가져옵니다. 따라서 pid을 기반으로 각 제품 페이지가 렌더링됩니다.
이 코드는 자동으로 데이터를 저장하면 데이터는 .htaccess
로 작성되고 페이지는 새로운 SEO URL로 렌더링됩니다.
그러나 클라이언트가 부하 분산 문제로 인해 add_rewrite_rule
대신 Apache에서 폴백 (FALLBACK)을 수행해야 할 때.
누구나 Fallback resource
과 동일한 작업을 수행하는 방법을 알려줄 수 있습니다.
마지막으로 "page_rewrite_rules"필터를 사용하여 .htaccess 파일에 쓰지 않고 완료했습니다. –
중복 전기; 진행자가 알림. http://wordpress.stackexchange.com/questions/141921/apache-fallback-instead-of-add-rewrite-rule - 곧 정리해야합니다. – hakre
이 질문은 WordPress SE에서 질문 및 답변 되었기 때문에 주제와는 거리가 먼 것처럼 보입니다. http://wordpress.stackexchange.com/questions/141921/apache-fallback-instead-of-add-rewrite-rule – Taryn