RewriteRule ^/pages/topic\.php?tag=$1 /topics/([^/] ) [R=301,L]
RewriteRule ^topics/([^/] )/?$ /pages/topic.php?tag=$1 [END]
我的問題與 301 重定向有關,我認為問題出在tag=$1并且/([^/] )我不完全確定我是否正確地完成了此操作,我想要的結果是,當用戶導航到/pages/topic.php?tag=cryptocom該用戶時,用戶會被重定向到/topics/cryptocom/感謝您的幫助.
uj5u.com熱心網友回復:
使用您顯示的嘗試/示例,請嘗試遵循 htaccess 規則檔案。
請確保在測驗您的 URL 之前清除您的瀏覽器快取。
RewriteEngine ON
##External redirect rules here.
RewriteCond %{THE_REQUEST} \s/pages/([^.]*)\.php\?tag=(\S )\s
RewriteRule ^ /%1/%2? [R=301,L]
##Internal rewrite rules here...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^topics/([^/] )/?$ /pages/topic.php?tag=$1 [NC,QSA,L]
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/423067.html
標籤:
