Mobile app version of vmapp.org
Login or Join
Harper822

: Remove fb_action_ids of the URL with .htaccess Sadly my website host will not let me have more than one .htaccess and therefor I am forced to include all rules for path parent and child virtual/physical

@Harper822

Posted in: #Apache #Facebook #Htaccess #Html

Sadly my website host will not let me have more than one .htaccess and therefor I am forced to include all rules for path parent and child virtual/physical URLS. My directory tree is as follows:


index.html


css
img
amixermusic


index.php
escuchar.php
css
img
js




This is the code for my htaccess:

RewriteEngine On +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([0-9]+)/$ /? [R=301,L]
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) www.example.com/ [R=301,L]

RewriteRule ^amixermusic/escuchar/(.+) /amixermusic/escuchar.php?id=
RewriteRule ^amixermusic/buscar/([^/]*)/?(.*) /amixermusic/index.php?q=&p=

RewriteCond %{QUERY_STRING} fb_action_ids=.*$
RewriteRule .* %{REQUEST_URI}? [R=301,L]

RewriteCond %{QUERY_STRING} fb_comment_id=.*$
RewriteRule .* %{REQUEST_URI}? [R=301,L]


Everything works fine except the lines are to remove fb_action_ids. I do not know what I should change. I forgot to mention that the like button is in "escuchar.php". This is generated automatically getting the URL of the window using PHP. So I think the statement should specify the directory, no?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Harper822

1 Comments

Sorted by latest first Latest Oldest Best

 

@Megan663

I suspect that your rule isn't firing because it is at the end of your file. It comes after some of your other rules that are marked as "Last" rules with the [L] flag. Just moving the rule up to the top of the file should help.

You could also combine it into a single rule by making the condition into this:

RewriteCond %{QUERY_STRING} fb_(action|comment)_id

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme