Wordpress更改永久链接并重定向新URL 301
我正在使用这个WordPress永久链接字符串Wordpress更改永久链接并重定向新URL 301,wordpress,.htaccess,redirect,Wordpress,.htaccess,Redirect,我正在使用这个WordPress永久链接字符串 /%postname%-%post_id%.html 但现在我想把它改为,并将所有旧的url重定向到新的url /%postname%.html 示例旧url为 http://www.example.com/dead-trigger-2-hile-mod-apk-indir-1890.html 新的url将被删除 http://www.example.com/dead-trigger-2-hile-mod-apk-indir.html 我的
/%postname%-%post_id%.html
但现在我想把它改为,并将所有旧的url重定向到新的url
/%postname%.html
示例旧url为
http://www.example.com/dead-trigger-2-hile-mod-apk-indir-1890.html
新的url将被删除
http://www.example.com/dead-trigger-2-hile-mod-apk-indir.html
我的htaccess文件当前使用默认wordpress变量。如何将我的所有URL重定向到新URL 301
我试着用这个,但它不起作用
RedirectMatch 301 ^/(.*)-([0-9]{4})$ http://www.example.com/$1
通过以下代码,您将能够通过.Htaccess实现301重定向: 语法:
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html
示例:
# BEGIN 301 Redirects
Redirect 301 /dead-trigger-2-hile-mod-apk-indir-1890.html http://www.example.com/dead-trigger-2-hile-mod-apk-indir.html
# END 301 Redirects
试试下面的方法
RedirectMatch 301 ^/([^/]+)-(\d+)/$ http://example.com/$1
所以你想从URL中省略帖子id吗?是的,就是在wordpress中,用htaccessDude重定向。我想重定向所有URL。所有帖子的url地址。我知道如何用这种方式写301重写url。