Make URL alias in Wordpress (or .htaccess)

怎甘沉沦 提交于 2020-12-30 07:00:14

问题


I have a site running on Wordpress, and I want to create one custom short-url.

If a page URL is www.mysite.com/category/post I want the user to be able to visit www.mysite.com/alias

If there is a 'Wordpress-y' way of doing things, that would be preferable, but I am also able to do it by modifying the .htaccess file.

Thanks


回答1:


<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^alias$ category/post [R=301,L]
</IfModule>



回答2:


I realize this is a bit of an old post, and already has an accepted answer, but for those of us not wanting to (or unable to) play with the .htaccess file, it should be noted that there are several viable plugins in this space.

I've used https://wordpress.org/plugins/redirection/ which has 800,000+ installs. There's also https://wordpress.org/plugins/simple-301-redirects/ with 200,000+ installs as well as several others with smaller install bases available at https://wordpress.org/plugins/search/redirect/.



来源:https://stackoverflow.com/questions/29444739/make-url-alias-in-wordpress-or-htaccess

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!