【发布时间】:2017-01-21 21:02:53
【问题描述】:
我想使用 htaccess 文件重定向一些 URL。
我的 htaccess 文件如下:
# 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>
Redirect /old-post-type/old-parent-post/old-post-slug/ /new-post-type/new-post-slug/
***** Some More URLs *****
# END WordPress
它应该重定向到http://yourwebsitedomain.com/new-post-type/new-post-slug/,但是,它正在重定向到http://yourwebsitedomain.com/new-post-type/new-post-slug/old-post-slug/
“old-post-slug/”自动添加到最后我不知道为什么?
接受任何建议。
【问题讨论】:
-
你好像在用WordPress,不如直接安装一下'Redirection plugin'?
标签: php wordpress .htaccess redirect