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. Intermediate & Advanced SEO
    4. Apache Mod Rewrite question

    Apache Mod Rewrite question

    Intermediate & Advanced SEO
    2 2 491
    • 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.
    • neooptic
      neooptic last edited by

      Hi everybody,

      I need to rewrite this url using mod rewrite, but I've got stuck.

      http://www.diamondgeezer.com/theultimate/search/index.php?sortprice=asc&followSearch=9673&q=eternity+rings

      I'd like it to show this one instead:

      http://www.diamondgeezer.com/eternity-rings

      I'm no expert on this stuff, so any help would be great!

      Thanks

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

        It's hard to write this kind of code without being able to debug it, but hopefully this will point you in some sensible directions.

        First my assumption - based on the URLs you included, I'm assuming you want to rewrite http://www.diamondgeezer.com/anything to serve http://www.diamondgeezer.com/theultimate/search/index.php?sortprice=asc&followSearch=9673&q=anything behind the scenes.

        I think there might be some complications around replacing hyphens (-) with pluses (+), but just serving the search results page for the word appearing after the first slash should be as simple as:

        ^/(.*) /theultimate/search/index.php?sortprice=asc&followSearch=9673&q=$1 
        

        The documentation here should help:

        http://httpd.apache.org/docs/current/mod/mod_rewrite.html

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post
        • Backlink Question
          gennarojewelers
          gennarojewelers
          0
          2
          75

        • How to answer questions when there no questions for my keyword
          DougRoberts
          DougRoberts
          0
          2
          51

        • Question on AMP
          paints-n-design
          paints-n-design
          0
          4
          48

        • Schema question
          Paddy_Moogan
          Paddy_Moogan
          0
          3
          256

        • Client Question
          Andy.Drinkwater
          Andy.Drinkwater
          1
          3
          86

        • Subdomain Question
          Francisco_Meza
          Francisco_Meza
          0
          3
          130

        • Followup question to rand(om) question: Would two different versions (mobile/desktop) on the same URL work well from an SEO perspective and provide a better overall end-user experience?
          retailgeek
          retailgeek
          0
          2
          202

        • On Page question
          RyanKent
          RyanKent
          0
          9
          690

        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