在htaccess(wordpress)中将较长url的规则重写为较短url
现在,完整的url如下所示: website.com/en_us/multimedia/blogs/podcast/2011/08/post title/ 我想把上面的url缩短为这个: website.com/podcast/2011/08/post title/ 与搜索引擎优化友好的301重定向 有人能给我一些建议吗 谢谢大家! 我当前的.htaccess文件如下:在htaccess(wordpress)中将较长url的规则重写为较短url,wordpress,.htaccess,mod-rewrite,Wordpress,.htaccess,Mod Rewrite,现在,完整的url如下所示: website.com/en_us/multimedia/blogs/podcast/2011/08/post title/ 我想把上面的url缩短为这个: website.com/podcast/2011/08/post title/ 与搜索引擎优化友好的301重定向 有人能给我一些建议吗 谢谢大家! 我当前的.htaccess文件如下: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L]
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
要从
website.com/en_us/multimedia/blogs/podcast/2011/08/post title/
重定向到website.com/podcast/2011/08/post title/
请在存在任何其他规则之前,将以下内容添加到.htaccess文件中
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} ^/en_us/multimedia/blogs/(.+)$ [NC]
RewriteRule . http://%{HTTP_HOST}/%1 [L,R=301]