HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

How to automatically redirect all URLs to Pretty URLs?

This discussion is related to the Vanilla addon.

Hi,

Now that Pretty URLs are kind of mandatory starting from version 2.3, I have enabled them in my forum.

The thing is that I thought all URLs would automatically be redirected to the new, pretty URLs, but that's not the case. And now I've got two URLs for every page. For example:

http://domain.com/discussion/28766/title-goes-here

http://domain.com/index.php?p=/discussion/28766/title-goes-here

(the two URLs lead to the same page)

I'm not an SEO expert, but I guess Google won't like that at all and might see that as duplicated content, which might lead to penalization, etc.

Is there a way to automatically redirect all URLs to Pretty URLs?

Thank you.

Comments

  • LincLinc Former Staff Detroit Admin

    Vanilla utilizes canonical URL meta tags to tell search engines which URL is the correct one, which means it's not marked as duplicated content. A 301 redirect shouldn't be necessary. If you wanted, you could probably implement one purely in your htaccess file.

  • @Linc said:
    Vanilla utilizes canonical URL meta tags to tell search engines which URL is the correct one, which means it's not marked as duplicated content.

    Thanks for your reply, @Linc. I appreciate it.

    I never noticed the canonical thing. Has it been there all the time? I mean, since I was using version 2.2.1 and non-pretty URLs, I wonder whether the canonical URL feature was working already and showing the URLs without the index.php?p= part.

  • K17K17 Unkorneglosk - Français / French Paris, France ✭✭✭

    @AristaP PrettyURLs are available since Vanilla 2.0 (or 1.* but not sure) so I think canonical URL was already here.

    AristaP
  • Hello.

    I am using version 3.3 and I have the same problem as @AristaP .

    Google indexes many urls with /index.php?p=/discussions/ and don't always select the right urls.

    However, canonical URLs are displayed correctly on pages.

    Is there a correct way to redirect (301) these urls to canonical urls?


    Thank you for your help.

  • @labastro

    However, canonical URLs are displayed correctly on pages.

    Then it should just take some time for Google to index them correctly.

  • labastrolabastro New
    edited September 14

    Thank you for your answer.

    I migrated to Vanilla last January, I find it a bit long (I have several thousand pages indexed with /index.php?p=/discussions/ and /index.php?p=/categories/).

    This is the reason why I am looking for a solution to redirect permanently these threads.

  • Redirect rules will be different depending on the server software you are using (apache, nginx, ...)

    What are you using?

    Google indexes many urls with /index.php?p=/discussions/ and don't always select the right urls.

    However, canonical URLs are displayed correctly on pages.

    The canonicals are correct even on pages that look like /index.php?p=... , right?

  • I am using Apache on a dedicated server.

    The canonicals are correct even on pages that look like /index.php?p=... , right?

    Yes.

Sign In or Register to comment.