찾다

 >  Q&A  >  본문

URL에 디렉터리 구조를 추가합니다. .htaccess 파일에 대한 301 리디렉션 규칙을 작성하는 방법은 무엇입니까?

내 웹사이트는 워드프레스 웹사이트인데 개조하고 싶어요

고정 링크는 http://도메인 이름/%post_id%.html에서 http://도메인 이름/%category%//%post_id%.html로 점프합니다.

이 경우 어떻게 해야 하나요? .htaccess 파일에 대한 301 리디렉션 규칙을 작성하면 어떻게 되나요?

현재 htaccess 파일은 다음과 같습니다.

# BEGIN WPSuperCache

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

#프록시 뒤에서 페이지를 제공하는 경우 'RewriteCond'를 변경할 수 있습니다. %{HTTPS}를 좀 더 합리적인 것으로 설정합니다

AddDefaultCharset UTF-8

RewriteCond %{REQUEST_METHOD} !POST

RewriteCond %{QUERY_STRING} !.*=.*

RewriteCond %{HTTP:Cookie} !^. *(comment_author_|wordpress_logged_in|wp-postpass_).*$

RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9"]+ [NC]

RewriteCond %{HTTP:Profile} ! ^[a-z0-9"]+ [NC]

RewriteCond %{HTTP:Accept-Encoding} gzip

RewriteCond %{HTTPS} on

RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/% {SERVER_NAME}/$1/index-https.html.gz -f

RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz" [L ). $

RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9"]+ [NC]

RewriteCond %{HTTP:Profile} !^[a-z0-9"]+ [NC ]

RewriteCond %{HTTP:Accept-Encoding} gzip

RewriteCond %{HTTPS} !on

RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html .gz -f

RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz" [L]

RewriteCond %{REQUEST_METHOD} !POST

RewriteCond %{QUERY_STRING} !.*=.*

RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$

RewriteCond %{HTTP:X-Wap-Profile } ! ^[a-z0-9"]+ [NC]

RewriteCond %{HTTP:Profile} !^[a-z0-9"]+ [NC]

RewriteCond %{HTTPS} on

RewriteCond % {DOCUMENT_ROOT }/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html -f

RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1 /index -https.html" [L]

RewriteCond %{REQUEST_METHOD} !POST

RewriteCond %{QUERY_STRING} !.*=.*

RewriteCond %{HTTP:Cookie} !^.*(comment_author_ |wordpress_logged_in |wp-postpass_).*$

RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9"]+ [NC]

RewriteCond %{HTTP:Profile} !^[a -z0 -9"]+ [NC]

RewriteCond %{HTTPS} !on

RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f

RewriteRule ^( .*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html" [L]

</IfModule>

# END WPSuperCache

# WordPress 시작


<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>


# END WordPress

# BEGIN EWWWIO

# END EWWWIO


大海潮涌大海潮涌2695일 전1518

모든 응답(3)나는 대답할 것이다

  • 那山

    那山2017-09-20 08:15:00

    thinkphp

    회신하다
    0
  • PHP中文网

    PHP中文网2017-09-19 16:35:58

    PHP의 301 점프 사용을 권장합니다

    Header("HTTP/1.1 301 Moved Permanently");
    Header("Location: http://www.php.cn".$_SERVER["REQUEST_URI"]);
    exit;


    회신하다
    0
  • 大海潮涌

    답변 감사합니다. 하지만 육안 검사는 적용되지 않습니다. http://domain name/%post_id%.html에서 일괄적으로 http://domain name/%category%/%post_id%.html로 이동하고 싶습니다. 중간에 디렉토리 이름을 추가합니다. 예: http://www.seoshipin.cn/1.html http://www.seoshipin.cn/seorumen/1.html로 이동

    大海潮涌 · 2017-09-19 18:55:27
  • 小小卫

    小小卫2017-09-19 16:11:26

    으르르르르


    회신하다
    0
  • PHP中文网

    브러쉬피콩 맞죠?

    PHP中文网 · 2017-09-19 16:36:33
  • 취소회신하다