The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. On-Page / Site Optimization
    4. How can I redirect anything after the article url to main article?

    How can I redirect anything after the article url to main article?

    On-Page / Site Optimization
    4 3 151
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • hakhan201
      hakhan201 last edited by

      Hello everyone,

      When someone visits my websites article like http://www.website.com/article-title/lol , it give to 404 page error. But when someone http://www.website.com/article-title/ , it shows the article. The word "lol" can be changed to anything. I would like that to be redirected to the main article.

      Example: Someone visits website.com/article-title/lol, they should be redirected to website.com/article-title/

      Is it possible to do so? If yes, please tell me how.

      Note: I'm using WordPress

      Thank you

      1 Reply Last reply Reply Quote 1
      • Mustansar
        Mustansar last edited by

        You simple need to define your URL rules through htaccess file this will resovle your issue.

        hakhan201 1 Reply Last reply Reply Quote 0
        • hakhan201
          hakhan201 @Mustansar last edited by

          Thanks Lkkie,

          It would be really kind of you if you can get me the .htaccess code which will help me fix my problem stated above.

          1 Reply Last reply Reply Quote 0
          • mediawyse
            mediawyse last edited by

            Here is the mod_rewrite code that would go in your Wordpress .htaccess file that would redirect

            http://www.website.com/article-title/lol

            to this:

            http://www.website.com/article-title/

            Options +FollowSymlinks
            RewriteEngine on
            RewriteRule ^article-title/lol(.*)$  http://www.website.com/article-title/$1 [r=301,nc]

            Make a note of this Mod_Rewrite Tool and it should help you with similar rules in the future.

            Hope that helps!

            1 Reply Last reply Reply Quote 2
            • 1 / 1
            • First post
              Last post
            • Which page will rank higher, my main article or the sub article linking from it?
              Leebi
              Leebi
              0
              5
              68

            • With 301 Redirects Does Changing URLs Matter?
              BlueprintMarketing
              BlueprintMarketing
              0
              4
              538

            • Our urls for adwords are slightly different from current urls presented on site (weused htaccess to help create shorter urls). How important is it that the adwords url match the sitemap url for keywords on those pages?
              LesleyPaone
              LesleyPaone
              0
              2
              134

            • Redirect both / and non-/ URLs?
              OVJ
              OVJ
              1
              5
              161

            • Redirecting URLS on windows
              ShaMenz
              ShaMenz
              0
              4
              317

            • Temp redirects of homepage URLs
              blu42media
              blu42media
              0
              2
              324

            • 301 redirects / clean urls
              RobertFisher
              RobertFisher
              0
              6
              680

            • Brand Name URL Redirecting to Actual URL
              iung
              iung
              1
              8
              524

            Get started with Moz Pro!

            Unlock the power of advanced SEO tools and data-driven insights.

            Start my free trial
            Products
            • Moz Pro
            • Moz Local
            • Moz API
            • Moz Data
            • STAT
            • Product Updates
            Moz Solutions
            • SMB Solutions
            • Agency Solutions
            • Enterprise Solutions
            • Digital Marketers
            Free SEO Tools
            • Domain Authority Checker
            • Link Explorer
            • Keyword Explorer
            • Competitive Research
            • Brand Authority Checker
            • Local Citation Checker
            • MozBar Extension
            • MozCast
            Resources
            • Blog
            • SEO Learning Center
            • Help Hub
            • Beginner's Guide to SEO
            • How-to Guides
            • Moz Academy
            • API Docs
            About Moz
            • About
            • Team
            • Careers
            • Contact
            Why Moz
            • Case Studies
            • Testimonials
            Get Involved
            • Become an Affiliate
            • MozCon
            • Webinars
            • Practical Marketer Series
            • MozPod
            Connect with us

            Contact the Help team

            Join our newsletter
            Moz logo
            © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
            • Accessibility
            • Terms of Use
            • Privacy