我的是wordpress的網站,想改版
固定連結從 http://網域/%post_id%.html 跳到 http://網域/�tegory%//%post_id%. html
這個該怎麼寫.htaccess檔301重定向規則呢?
以下是目前的htaccess檔:
## 結束EWWWIO# BEGIN WPSuperCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
AddDefault
RewriteCond %{REQUEST_METHOD} !POSTRewriteCond %{QUERY_STRING} !.*=.*RewriteCond %{HTTP:Cookie} !^.*(comment_author_#RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|word| postpass_).*$RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"] [NC]RewriteCond %{HTTP:Profile} ! ^[a-z0-9\"] [NC]RewriteCond %{HTTP:Accept-Encoding} gzipRewriteCond %{HTTPS} on#RewriteCond %{ DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz -fRewriteRule ^(.*) "/wp-content/cache/supercache/%{ SERVER_NAME}/$1/index-https.html.gz" [L]RewriteCond %{REQUEST_METHOD} !POSTRewriteCond %{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} gzipRewriteCond %{HTTPS} !onRewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index. html.gz -fRewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz" [L]
#RewriteCond %{REQUEST_METHOD} !POSTRewriteCond %{QUERY_STRING} !.*=.*#RewriteCond %{HTTP:Cookie} !^.*(comment_
##RewriteCond %{HTTP:Cookie} !^.*(comment_
## |wordpress_logged_in|wp-postpass_).*$RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"] [NC]RewriteCond %{ HTTP:Profile} !^[a-z0-9\"] [NC]RewriteCond %{HTTPS} onRewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/ %{SERVER_NAME}/$1/index-https.html -fRewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html" [L ]RewriteCond %{REQUEST_METHOD} !POSTRewriteCond %{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} !onRewriteCond %{DOCUMENT_ROOT }/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -fRewriteRule ^(.*) "/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} !-f
RewriteCond %{REQUEST_FILENAME} !-d##} !-d
重寫規則。 /index.php [L]
## 結束 WordPress
# 開始 EWWWWIO
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;