Fügen Sie der URL eine Verzeichnisstruktur hinzu. Wie schreibe ich 301-Umleitungsregeln für die .htaccess-Datei?
大海潮涌
大海潮涌 2017-09-19 14:41:54
0
3
1345

Meine Website ist eine WordPress-Website und ich möchte sie überarbeiten

Der feste Link springt von http://domain name/%post_id%.html zu http://domain name/%category%//%post_id%.html

Was soll ich damit machen? Wie wäre es mit dem Schreiben von 301-Umleitungsregeln für .htaccess-Dateien?

Hier sind die aktuellen htaccess-Dateien:

# BEGIN WPSuperCache

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

#Wenn Sie Seiten hinter einem Proxy bereitstellen, möchten Sie möglicherweise „RewriteCond“ ändern %{HTTPS} weiter zu etwas Vernünftigerem

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: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

# BEGIN 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>


# ENDE WordPress

# BEGIN EWWWIO

# ENDE EWWWIO


大海潮涌
大海潮涌

学习,学习,学习!

Antworte allen(3)
那山

 thinkphp

Ty80

建议使用php的301跳转

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


  • Antwort 谢谢回答,不过目测不适用,我是要从从 http://域名/%post_id%.html 跳转到 http://域名/%category%/%post_id%.html ,批量的,中间增加目录名称。 比如:http://www.seoshipin.cn/1.html 跳转到 http://www.seoshipin.cn/seorumen/1.html
    大海潮涌 Autor 2017-09-19 18:55:27
小小卫
娶回家我的表情屋都比都不会1笔UIu32b32b2ibf2iuffn我请你点击暖气内勤入侵群人UI完全纳入刘清华人u3qhrh三好厌i三群人很好奇和日期和其如何去武汉李红日


  • Antwort 刷P豆的吧
    PHP中文网 Autor 2017-09-19 16:36:33
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!