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. Technical SEO Issues
    4. URL Rewrite

    URL Rewrite

    Technical SEO Issues
    13 8 1.9k
    • 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.
    • CraigAddyman
      CraigAddyman last edited by

      Using the .htaccess file how do I rewrite a url from

      www.exampleurl.com/index.php?page=example

      to

      www.exampleurl.com/example

      removing index.php?page=

      Any help is muchly appreciated

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

        What about:

        RewriteRule ^index.php?page=(.*)$ /$1 [R=301,L]

        CraigAddyman 2 Replies Last reply Reply Quote 7
        • CraigAddyman
          CraigAddyman @petrakraft last edited by

          And do I have to set up a new url or does it actually rewrite the existing URL?

          I really can't get my head round this

          petrakraft BlinkWeb 2 Replies Last reply Reply Quote 0
          • CraigAddyman
            CraigAddyman @petrakraft last edited by

            This is what the current file looks like if it helps

            RewriteEngine On

            RewriteBase /

            RewriteRule ^index.php$ - [L]

            RewriteCond %{REQUEST_FILENAME} !-f

            RewriteCond %{REQUEST_FILENAME} !-d

            RewriteRule . /index.php [L]

            1 Reply Last reply Reply Quote 0
            • Dan-Petrovic
              Dan-Petrovic last edited by

              RewriteEngine on RewriteRule ^page/([^/.]+)/?$ index.php?page=$1 [L]

              If you're using the numbered (e.g. page=102) IDs:

              RewriteEngine On RewriteRule ^article/([0-9]+)/? article.php&article=$1   [R=301, L]

              CraigAddyman 1 Reply Last reply Reply Quote 1
              • CraigAddyman
                CraigAddyman @Dan-Petrovic last edited by

                Will this have any negative effect in the serps?

                Dan-Petrovic 1 Reply Last reply Reply Quote 0
                • goodnewscowboy
                  goodnewscowboy last edited by

                  Hiya Craig:  This post from YOUmoz might help you to be able to wrap your mind around it better.

                  tomcraig86 1 Reply Last reply Reply Quote 2
                  • Dan-Petrovic
                    Dan-Petrovic @CraigAddyman last edited by

                    URL rewriting is a common and safe practice and as goodnewscowboy points out: http://www.seomoz.org/ugc/a-simple-guide-to-htaccess - just test it and see that nothing funky is going on with your site and note that the above examples are not customised to your particular site / page structure.

                    Search engines are good with picking up 301s for new pages. If your pages are already in index and have links the only downside is that you may lose a bit of anchor text focus (I remember Matt Cutts talking about this in one of his videos) but link juice should pass through just fine.

                    1 Reply Last reply Reply Quote 1
                    • petrakraft
                      petrakraft @CraigAddyman last edited by

                      This line should exclude that part: index.php?page=

                      Just try if it works.

                      1 Reply Last reply Reply Quote 0
                      • tomcraig86
                        tomcraig86 @goodnewscowboy last edited by

                        Thanks for that pointer goonewscowboy, I just stumbled across this article and it was a good read

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

                          I had a similar problem and found this site particuarly useful: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

                          Works great for me now. Good Luck.

                          1 Reply Last reply Reply Quote 0
                          • BlinkWeb
                            BlinkWeb @CraigAddyman last edited by

                            You have to setup a new URL. The rewrite only redirects traffic. If the page doesnt exist you are redirecting traffic to a page that doesn't exist. No Bueno!

                            1 Reply Last reply Reply Quote -1
                            • Gaveltek-173238
                              Gaveltek-173238 last edited by

                              I would mark this question as answered, it seems that a lot of great minds have come together and given a lot of really accurate responses. It just keeps others from re-answering.

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              • Url rewrite subfolder
                                TheeDigital
                                TheeDigital
                                0
                                6
                                150

                              • How to find original URLS after Hosting Company added canonical URLs, URL rewrites and duplicate content.
                                Nobody1560986989723
                                Nobody1560986989723
                                0
                                2
                                366

                              • URL rewriting causing problems
                                Dr-Pete
                                Dr-Pete
                                0
                                5
                                535

                              • Need Help with MAGENTO - URL rewrite
                                Prime85
                                Prime85
                                0
                                9
                                1.4k

                              • What are the impact of doing URL Rewriting instead of 301 redirections whille optimizing a blog?
                                ShaMenz
                                ShaMenz
                                0
                                4
                                1.3k

                              • Difference between URL Rewrites and 301 Redirects for Rankings
                                Gaveltek-173238
                                Gaveltek-173238
                                0
                                4
                                570

                              • URL Rewrite
                                oznappies
                                oznappies
                                0
                                4
                                1.0k

                              • Rel=Canonical to Rewrite or original URL?
                                PathInteractive
                                PathInteractive
                                0
                                3
                                994

                              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