Removing URL parameter via .htaccess

Posted on 2011-10-11
Last Modified: 2012-08-13

In my Google Analytics incoming reports I have lot of urls with a NOT MINE url parameter added at end that is leading to a page not found error:

For example:

When the right URL is /search/pdf/ejercicios+de+las+7+herramientas+de+calidad

As you see the "?fb_xd_fragment=" is added at the end of my URL.

It seems to be a facebook button issue:

But what i want is to redirect this:

to this: /search/pdf/ejercicios+de+las+7+herramientas+de+calidad

How can I do this from my htaccess ?

Please help!!

thank you
Question by:Fernanditos
    LVL 13

    Accepted Solution

    Try this

    RewriteEngine On
    RewriteRule ^/search/pdf/ejercicios+de+las+7+herramientas+de+calidad?fb_xd_fragment=  /search/pdf/ejercicios+de+las+7+herramientas+de+calidad? [R=301,L]

    Open in new window


    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^fb_xd_fragment=$
    RewriteRule ^(.*)$  /search/pdf/ejercicios+de+las+7+herramientas+de+calidad? [R=301,L]

    Open in new window


    Author Closing Comment

    As usual, I was forced to accept a solution. This did not fix my problem because I have lot of URLs with that issue, the idea was to do something without entering individual urls on the .htaccess.
    LVL 107

    Expert Comment

    by:Ray Paseur
    @fernanditos: You are not forced to close a question if you have outstanding dialog.  You can explain a little more or ask clarifying questions.
    LVL 13

    Expert Comment

    @Fernanditos: just wanna help you out, it's not about points here. I could have helped you better if you had clarified your question since the beginning :)

    In your case, try

    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^fb_xd_fragment=$
    RewriteRule ^(.*)$  /$1? [R=301,L]

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
    Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
    This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now