Redirect many urls ending with - redirect

can someone help me with the syntax:
I want to redirect all urls that end with
&filter-sort-order=desc to a single url
the full url is something like this:
https://www.example.com/page/4?post_type=property&s=2022&filter-sort-by=price
I can't find the correct syntax.

Related

Redirect url containing string to same url without string

I need to redirect my addresses from a website to another one.
My current urls are like this:
mysite.com/test/.../.../...
or www.mysite.com/test/...//...//
so I need to redirect all of my pages to mysite.com/.../.../... or www.mysite.com/.../... so actually I need to redirect to the same url but without the test/.
Any ideas on doing it preferably via .htaccess?
Thank you in advance
redirect from root folder yoursite.com/...//...
https://www.redhat.com/sysadmin/beginners-guide-redirects-htaccess

Rewrite .html files in Netlify

I am trying to rewrite patterns like /abc.html to /search?xyz=abc. 'abc' can be anything.
I've gone through the documentation at https://www.netlify.com/docs/redirects/
Here's what I have now in my _redirect file, but it doesn't seem to work. Kindly help.
/*.html /search?xyz=:splat 200
Disclaimer: I work for netlify
Our redirects functionality does not work to do rewrites like that. Placeholders like slugs (/blog/:year/:month/:day/:title) and stars (/assets/*) are only matched as full path components - that is, the thing between slashes in a URL or "everything after this / including files in subdirectories".
It's not an uncommon feature request, but our system doesn't work like that right now.
Some ways you can achieve similar goals:
usually you aren't intending to redirect existing paths. This portion of the docs demonstrates that a standard redirect (/articles/* /search?xyz=:splat 301) will redirect all requests for missing content - be that /articles/1 or /articles/deep/link/that/was/tpyoed.html - to /search with a xyz parameter of the pathname . This doesn't do exactly what you asked - but it is probably the closest thing and you can hopefully handle the paths appropriately in your /search page. In case you have any contents under /articles, that will still be served, and not redirected, since you didn't put a ! on the redirect to force it.
if you have a single page app that does its own routing and use a history pushstate redirect you could make the router do the right thing for your content since usually there is only one .html page on your site and any other paths would be redirected to it (where the router takes over with whatever smarts you give it)

ee: redirect url with trailing forward slash

How can I redirect to the correct page if somebody adds a trailing forward slash to a url in expression engine?
For example:
A) www.acme.com/event - is the correct url
B) www.acme.com/event/ - has the same content
The problem is I'm using Disqus as a commenting system and it interprets both as different pages. So the simple solution is to redirect to url A when the trailing slash appears.
{if segment_2=="event/"}
{redirect="/event"}
{/if}
This doesn't seem to work. Any ideas that don't involve .htaccess? It's only for one page.
Thanks.
Rewriting my comment as an answer...
Looks like the URL doesn't matter. It's the value of disqus_url that uniquely identifies that page. You should be able to set that reliably.
From the documentation...
disqus_url
Tells the Disqus service the URL of the current page. If undefined,
Disqus will take the window.location.href. This URL is used to look up
or create a thread if disqus_identifier is undefined. In addition,
this URL is always saved when a thread is being created so that Disqus
knows what page a thread belongs to.
While the window.location.href is used in absence of disqus_url, we
highly recommend defining this variable. If a user visits your page at
the URL http://example.com/helloworld.html?123, Disqus may in fact
load a different thread than if the user came from
http://example.com/helloworld.html.
To make sure the right thread is always displayed, you should define
on your page, using an absolute URL, var disqus_url =
'http://example.com/helloworld.html';

How to create FB likebox with special URL characters

I'm trying to create a like for box my clients FB page:
https://www.facebook.com/pages/Cateringinventardk-alt-til-dit-storkøkken-og-café
I guess that little ø or é is messing it up, I got this error:
*The href parameter must reference a valid Facebook page, but "https://www.facebook.com/pages/Cateringinventardk-alt-til-dit-storkøkken-og-café" is not a valid Facebook page.
Anyone who know how I can prevent that with special url/code?
Thanks in advance!
Jan Joergensen
You could try and specify a url-encoded value for the URL. For the URL you supplied this would be something like this:
https%3A%2F%2Fwww.facebook.com%2Fpages%2FCateringinventardk-alt-til-dit-stork%C3%B8kken-og-caf%C3%A9
I've always used this tool, but any other url-encoding tool should do the same job. You might not need to encode the entire URL but rather only the "problematic" characters. For you that's everything after /pages/.
Cateringinventardk-alt-til-dit-storkøkken-og-café
Would become
Cateringinventardk-alt-til-dit-stork%C3%B8kken-og-caf%C3%A9
^----^ ^----^
encoded ø encoded é
I had to use the full url, not just the page vanity url

URL Rewriting and Facebook link information retrieval

I am developing a website and I want to integrate it with Facebook, allowing users to share the pages of my website in their FB walls. My problem is explained in the following lines and my question is at the end.
I am using the following URL rewriting rule in my .htaccess file:
RewriteRule ^([a-zA-Z0-9_-]+)\/?([a-zA-Z0-9_-]+)\/?$ index.php?p1=$1&p2=$2
That means it will rewrite anything like: http://address/parameter1/parameter2 as http://address/index.php?p1=parameter1&p2=parameter2.
When I post http://address/parameter1/parameter2 on FB, it will only show the rewritten URL under that URL.
I posted http://address/index.php?p1=parameter1&p2=parameter2 on FB, and it will show the information I want it to show, the ones I have put in the meta tags.
I tried debugging http://address/parameter1/parameter2 on the FB debugger (http://developers.facebook.com/tools/debug), I will get the error:
"The page at ... could not be reached because the server returned status code 400."
Is there any way I can correct that? That is, actually making the dynamic link behave like a static link, and making that transparent to anyone who links it?
Edit:
This change in the rewrite rule should solve the problem:
RewriteRule ^([a-z0-9_-]+)/?([a-z0-9_-]+)/?$ index.php?p1$1&p2=$2 [L,NC]
I also changed the redirects in PHP that I was doing.
And that solved my problem.
I have similar issue to yours, except I manage url rewriting with php dynamically.
I am currently a web host that do not allow url rewriting through htaccess (free.fr)
dynamic standard url is handled properly. But not rewrited url.
How would you get rid of this, considering header status code?
What I could do is doing a redirect instead of include script which produce html output code.
Just have to tell the handler to switch between include and redirect, thanks to a special added param in the url.
But it's not a pretty solution.