The MU forums have moved to

Redirect visitors to home (4 posts)

  1. xrun
    Posted 14 years ago #

    How do I redirect all visitors coming in from outside, f.ex. using a direct link to a post or page on google, to the home page on the site?

    The problem is that several themes won't work properly if a direct link to a post, page or category is used from outside, and may end up showing in a wrong format, or sometimes not at all.

  2. SteveAtty
    Posted 14 years ago #

    Surely the whole idea of permalinks is that you CAN link directly to a specific page/post etc from outside. Sounds like a pretty crap theme if it screws up peramlinks.

  3. xrun
    Posted 14 years ago #

    Sure, but how about themes that places certain parts of the content in a sidebar or uses other formatting than a straight post. If the content is linked directly these things may look funny in the browser.

    Of course it's possible to place conditions in the header, making the theme load these elements correctly if a certain page or category is not referenced. For example if posts in certain categories are shown in a pretty carousel. Then it would be a simple matter to use is_home() or is_page() or something.
    This solves my current issue, but it would be nice to have a simple solution to redirect visitors to home based on certain criteria.

  4. cogmios
    Posted 14 years ago #

    I don't really understand why you need it. So you say that:

    - there are certain widgets in the sidebar that promote their own url instead of the permalink which belongs to a post/page ?
    - and that this own url only shows a part of the page??

    isn't it possible to adjust these widgets/things to use the correct url?

    Anyway... with .htaccess rules you can probably do whatever you like e.g.

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule /.* [R=301,L]
    RewriteRule (.*) [R=301,L]

    p.s. i just checked this url and it exists... what a smartass who registered that one LOL.

About this Topic