nginx fbclid remove from url - facebook

I have following nginx rewrite. But from simple html link work it very well and from facebook not. First time go to correct url and shortly after few seconds to home url.
if ($query_string ~ "^(.*)fbclid=(.*)$") {
rewrite ^(.*)$ $uri? permanent;
}
url structure is following:
https://tld.com?fbclid=IwAR0B_MwRdL9H6OXoAINh1mOFL81J-MV4jOSg2qjaCPs7l4fawFIwYiLv7r4#!төмөр-хүлэг/зарах/авто-мото/суудлын/богино/449682/fit-зарна
example link
question: Why this link not working from facebook?

Related

Does a Redirect in HTACCESS count as a Google Analytics hit?

I got tried of so many attempts to find WordPress on my web site which does not even have WordPress so I did a Redirect offsite.
Shortly after doing this my Google Analytics bounce rate went up at the exact same time.
Is this just coincidence?
RedirectMatch 302 /wp-login.php(.*) http://www.someotherdomain.com/
Your problem is your htaccess code.
If i follow you properly, you are noticing that people (bots) are visiting pages that do not exist on your site. I can show you the correct notation for your solution, by the way why not redirect to wordpress themselves :) . You also have the choice of redirecting permanently, i would do that instead as it shows visitors the page doesn't exist - you can use '301' (permanent) or '302' (temporary). You can also use "Redirect" for single pages or "RedirectMatch" which uses regex for more multipage re-directs, for your solution either can work, i show both below:
Here are your 2 "Redirect" options:
# Permanent Wordpress bot fix
Redirect 301 /wp-login.php https://wordpress.com/
OR
# Temporary Wordpress bot fix
Redirect 302 /wp-login.php https://wordpress.com/
Here are your 2 "RedirectMatch" options:
# Permanent Wordpress bot fix
RedirectMatch 301 ^/wp-login\.php$ https://wordpress.com/
OR
# Temporary Wordpress bot fix
RedirectMatch 302 ^/wp-login\.php$ https://wordpress.com/
The code that caused your trouble is (.*), this is used in site-wide redirects, usually like this:
# Redirect ALL pages to home page
RedirectMatch 301 ^(.*)$ http://www.sitetwo.com
OR
# Redirect ALL pages, like for like
RedirectMatch 301 ^(.*)$ http://www.sitetwo.com/$1
HTH

where to redirect old prestashop urls?

Hello could somebody please tell me where to redirect urls of old removed products from prestashop 1.6.0.9?
Is it right to redirect them to 404 page or to homepage? (whats better?)
AND HOW TO REDIRECT IT?
Actually when I type link of removed product to browser it redirects me to custom page of my website but just with warning in red rectangle:
1 error
1. Product not found
(see the attachment in link)
http://s11.postimg.org/wm2ho4b2b/image.jpg
Thanks in advance.
I think you had to use a 301 redirect. modify/create a htaccess file like this:
//redirect from URL to other
RewriteRule /old_url_of_product.html http://www.homepage_website.com/ [R=301]
First parameter are the old url, next are the new url.
This is the best way for SEO.

Show a wordpress page in Facebook Page as a Site, using app_data paremeter

Good fellas,
My client requested a site in Wordpress, for now I will call www.example.com, but he wanted the site displays it too as a Facebook Page. Because the server with SSL is for other domain www.serverssl.com, I put the wordpress site at a relative directory on serverssl, so I have this:
www.serverssl.com -> Document Root: /var/www/html/ (using ssl)
www.example.com -> Document Root: /var/www/html/example/site
For Facebook Page -> www.serverssl.com/example/site (using ssl)
Because Wordpress is configured at relative path, at first time when I tried to get at Facebook Page it didn't work. So I've added some lines to .htaccess at Document Root of Wordpress:
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ http://www.example.com/$1 [R,L]
So, if I tried to reach www.facebook/com/Client/app_00000000/ the iframe redirect to www.example.com so works fine.
Well, the client now wants other think: He wants a link to enter a Facebook Page that shows a specific page in wordpress. So I thought use app_data parameter, like this:
www.facebook.com/Client/app_00000000?app_data=specificpage
then at header.php of wordpress' theme evalutes the $_REQUEST['signed_request'] parameter in order to search the app_data and then redirect to specificpage.
But the header.php nevers see the REQUEST send by Facebook,
I tried with the .htaccess:
RewriteCond %{QUERY_STRING} ^signed_request=(.*)$ [NC]
RewriteRule . http://www.example.com/%{QUERY_STRING} [R,L]
Still does not sent the signed_request.
Any idea how reach send signed_request through redirect?
PD: Sorry my bad english :(
If you load the page in a Facebook iframe it will always pass the signed_request on the first load.
I am not too great with mod-rewrite but I would suggest verifying the rewritecond on the signed request. Other values may have being transferred as well causing your condition to fail.

I want to redirect the index.php from a Wordpress site to another URL, and all the other URLs in the WP site separatley

So, here is the problem:
I need to have a redirect from website.ro/ to website.com/
Website.ro is on wordpress.
At the same time, all the sub-links like website.ro/title will be redirected individually to website.com/different_title_same_content
If i do this:
Redirect 301 /index.php http://website.com/
Redirect 301 /title http://website.com/different_title_same_content
What happens is that website.ro is on wordpress, that means that all the sublinks are called through index.php (i think, but not sure) and if i do a redirect on index.php than all the other links will be redirected to the homepage and not to their corresponding innerpage.
Its like setting a master rule when i'm redirecting the index.php.
What i would like to do is redirect index.php to a homepage, and any other variation on its corresponding subpage on the new website.
Can it be done?
EDIT: I have added a little of the code that i have to write:
Redirect 301 /Zuzu newsite/portfolio/cases/doc/47860743/
Redirect 301 /Antena1 newsite/portfolio/cases/doc/47860862/
...and so on for allmost 100 urls. (i had to post here without http and www since i am not allowed here more than 2 urls)
The reason i have to do this is that in the past, many of the links on the oldsite appeared in articles, press, blogs and so on, and i do not want to loose traffic that the old links generated on each page.
At the same time, i want to redirect the homepage to the newsite homepage, but if i do this with:
Redirect 301 / newsite/
it will redirect all the other links to the main page of the newsite and not to its corresponding article.
Its the same if i do Redirect 301 /index.php newsite/
since the old website is on wordpress and i think that all the pages are called through index.php(and some variables)
Also, the urls on the newsite.com are not rewritable as to rename them as the old ones so i can create an automated redirect generally valid.
WHAT IS THERE TO DO?
Look into this it may solve your issue
http://enarion.net/web/htaccess/migrate-domains/
Best of luck!

Sitewide 301 Redirect

I am looking to perform a sitewide 301 redirect. The original site is over 15 years old! I understand the concept of making the .htaccess file with the code:
redirect 301 "/old/old.htm" http://www.you.com/new.html
However will this redirect every page of the old site? or just an individual page. How do I achieve redirection with the entire site?
I have a rewrite in .htaccess (apache rewrite mod enabled), all pages from old site
http://www.old.com and
http://www.old.com/site/index.php? .... redirect to the new site
http://www.new.com or
http://www.new.com/website/index.php?... (notice that /site/ and /website/ are different names)
pages from the old site
https://www.old.com (notice the s on https://) get redirected fine but pages from
https://www.old.com/site/index.php?... do not, they get a 404 error
since the old site is not secure anymore neither the
https://www.old.com or
https://www.old.com/site/index.php?... really exist anymore but
https://www.old.com gets redirected and the ones with
/site/index.php?... added do not get redirected but go instead to a 404 error
Be careful with a 301, 301 redirect is used for where content has moved.
e.g. content about making a cake was here /makeacake.html now is /cakes/making-a-cake.html.
what I would recommend is find the pages where the majority of your uses come to, and redirect those pages to the new relevant pages / sections and just delete the rest and add a custom 404 error page. which tells them the old content has been moved.
You can also use goggle web masters to remove pages from there index.
Assuming the old pages don't exist any more (would throw 404-errors), you can do the following: You redirect all the pages that don't exist anymore to the start page. (As specified in the comments below.)
This is the updated .htaccess code you can use to make that happen. The first RewriteCond checks if the requested path is a file, the second checks if its a directory. After that, you get redirected to the startpage - or any other page for that matter.
http://www.example.com/i/am/an/old/page.html or http://www.example.com/i/am/a/different/old/page.html will all redirect to http://www.example.com/
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . / [R=301,L]
The best way to redirect the entire site is by doing domain forwarding through your web server (or web host... most have the option in their control panel).
Domain forwarding is much more efficient than sending 301 redirects back to the client.
Am I right in thinking that your site is on the same domain name but you've changed it structurally?
So, you have a load of old page URLs that have now changed to new URLs (but on the same domain).
For example, you may have had:
www.yourdomain.com/about-us/history.htm
that has now become
www.yourdomain.com/our-history.htm
If that is the case you will more than likely need to set up many 301 redirect rules. It doesn't necessarily mean that you have to set up one rule for every single page change as you can use RegEx to catch pattern changes in the URL structure. As a scale example, I recently set up a htaccess file of 301 redirects for a site with just under 600 changed URLs. There were 70-something 301 Redirect rules in the end.
It's not necessarily a small job but it is doable. Worth it to retain your SEO rankings.