【发布时间】:2014-01-06 18:10:26
【问题描述】:
我们最近将我们的网站转移到了一个新的 CMS,但我一直在重定向一个目录。
我们的旧 URL 结构是这样的:
/目录/子目录/this-is-the-post/81281/
我想把它重定向到:
/this-is-the-post-81281
当前的 .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>
RewriteEngine On
RewriteRule ^[^/]+/[^/]+/([^/]+)/([0-9]+)/?$ /$1-$2 [L,R]
#Redirected wildcard /new to forward slash.
RedirectMatch 301 /new/(.*) /$1
【问题讨论】:
标签: apache .htaccess mod-rewrite redirect http-status-code-301