wordpress how to force redirection from all pages

2019-08-29 13:07发布

I have a one-page wordpress site. It uses pages and posts but is all programatically included in the core template. I don't want users to ever accidentally access a single posts (even though it's unlikely that would ever happen). I would prefer to not have to use a 404 template either so it would be great to redirect EVERY page to the home page. Is this easily done without interfering with the default .htaccess rules?

3条回答
仙女界的扛把子
2楼-- · 2019-08-29 13:35

I ended up using this plugin and redirecting each page manually, thus leaving irrelevant pages to throw a 404 error. It's not what I wanted but in the end it's best practice.

查看更多
一夜七次
3楼-- · 2019-08-29 13:49

Add this line of code to your htaccess file:

redirect 301 / http://www.yoursiteurl.com/

Replace "yoursiteurl" with your actual domain.

查看更多
再贱就再见
4楼-- · 2019-08-29 13:51

Try using this plugin. It allows redirection of all URLs.

查看更多
登录 后发表回答