我已經建立了一個網站的食譜,但在遷移的過程中,舊的URL轉到新的URL我面臨的問題。重定向的提取URL
https://example.com/recipes/cheesy-baked-tacos/
這是我的舊的URL結構,在WordPress網站我需要提取URL「俗氣出爐,玉米餅」的最後一部分和處理,在我使用的配方頁面的模板。
現在,當我點擊URL時,即使食譜頁面已經設置,它也會進入404頁面。
我嘗試以下htaccess的規則,但沒有成功提前
RewriteBase/
RewriteRule ^recipes/(.*)$ index.php?l=$1
感謝。
完全htaccess文件看起來像這樣
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^recipes/(.*)$ index.php?l=$1
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
您是否啓用了RewriteEngine?要啓用它,您需要在htaccess頂部的**上使用** RewriteEngine。 – starkeen
你的規則對我來說看起來不錯。你要去哪個網址? – starkeen
,將我引導到404頁面 –