Redirect not working for me - asp-classic

I have the following line in my IsapiRewrite.ini file:
RewriteRule ^/test-url.asp$ http://www.google.co.uk/ [R=301,L]
But it doesn't do anything...
However, this DOES work:
RewriteRule ^/test-url.asp$ /
Is it a case of enabling Redirect or something like that? I would have thought that if the IsapiRewrite4.dll is running, the redirect would work?
Please can someone advise?

Try this (slightly modified to be case insensitive):
RewriteRule ^/test-url.asp$ http\://www\.google\.co\.uk/ [I, R=301,L]

Turns out to be the documentation on the Isapi Readme...
To do redirect, its not "RewriteRule", but instead "RedirectRule"... just tried it by chance. Ended up working. However, the above suggestions do work on .htaccess Linux servers.
Thanks guys.

Related

.htaccess regex beginner redirection problem

I'm a beginner in redirecting with htaccess. I wanted to do a small redirect, but am already stuck.
My first redirect was:
RewriteRule ^/project/(.*) /search/?type=details&projectid=$1 [R=301,L]
Which works fine. The problem is, that if the link gets shared on facebook, the outbound link of facebook is added with a ?fbclid=XXX. So my links get turned into:
/search/?type=details&projectid=1?fbclid=XXX
So now I somehow have to find the "?fbclid=XXX" (in case there is one) and stick it behind a &. For now I have:
RewriteRule ^/project/([^/]*)/?(.*)$ /search/?type=details&projectid=$1&$2 [R=301,L]
But this only works if there is a / inbetween the projectid and ?fbclid.
Can anyone give me a clue, what I'm missing?
thank you very much.

Redirect one image to webpage Issue

I hope everyone is well.
I am having a few issues trying to redirect an image that was linked in error from an email to a html page.
For example the email points here - https://www.caravanguard.co.uk/news/wp-content/uploads/2021/03/Swift-Vogue-580-1.jpeg
But should point here - https://www.caravanguard.co.uk/news/make-mine-a-dealer-special-caravan-25644/
I have appplied the following to our .htaccess, but it does not appear to have worked. I have also done the same in the wordpress yoast plugin we use.
redirect 301 /news/wp-content/uploads/2021/03/Swift-Vogue-580-1.jpeg /news/make-mine-a-dealer-special-caravan-25644/
Any ideas?
With your shown samples, could you please try following. Please make sure to place these rules at top of your .htaccess file. Also please do clear your browser cache before testing any URLs.
RewriteEngine ON
RewriteRule ^news/wp-content/uploads/2021/03/Swift-Vogue-580-1\.jpeg/?$ /news/make-mine-a-dealer-special-caravan-25644/ [R=301,NC,L]
You can use a RewriteRule
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/news/wp-content/uploads/2021/03/Swift-Vogue-580-1.jpeg$
RewriteRule ^.+$ /news/make-mine-a-dealer-special-caravan-25644/ [R=301]
Make sure this rule is at the top of your htaccess or before your WordPress rules.
Had to remove the image from wordpress before it would allow the redirect to work. WP rules seem to have got in the way. The .htaccess rule I originally created then kicked in.
I tried the above comments prior to the deletion and they did not work. Cheers for your help both.

Get data from one url by using custom url pattern wp

Can anybody suggest me this-
example.com/topic/a-1.html using this url i want to get data from
example.com/topic?page=a&number=1 in wp.
I tried wp rewrite functions but that could not helped me.
& I tried this too.
RewriteEngine On
RewriteRule ^([^/])/([^/]).html$ /topic?page=$1&num=$2 [L]
Thanks for your reply.
If you set permalinks in options, all links in your site will have the form site.com/page, but if you need delivery get parameter you can do it anyway, adding at the end of the get request site.com/page?id=1&page=2
Well finally i got this rule.
i was missing index.php thats why wp was redirecting to 404.
RewriteRule ^topic/([^/])/([^/])$ index.php/topic?page=$1&num=$2 [L]
Finally it worked for me. :)

Rewriting URL still redirects to old URL

I am trying to access
https://www.onlybrighton.com/optin-ninja/onlybrightona/
using
https://www.onlybrighton.com/jani
but it doesn't seem to be working right and it's redirecting me to
/onlybrightona/
URL when I enter
/jani
URL in browser
I am using follwing rule:
RewriteRule ^jani$ /optin-ninja/onlybrightona/ [QSA,L]
Apologies for being so blunt but I really am new into this.
Edit: in a nutshell my problem is .htaccess rule redirecting, but not rewriting
Can you please try it :
RewriteRule ^jani/?$ https://www.onlybrighton.com/optin-ninja/onlybrightona/ [R=301,NC,L]
Please try above code and let me know.

Symfony & mod_rewrite

Looking for some good skills in mod_rewrite or Symfony (not sure from where the problem comes!)
I was using mod_rewrite normal, but somehow, I can't get this to work. I mean, when requesting this url:
A- http://www.balancextreme.es/pulseras-y-zapatillas-famosos.html
should load:
B- http://www.balancextreme.es/tiendaweb/pulseras-y-zapatillas-famosos/culture/es.html
ok, but not as a redirect, I mean, the address bar must be showing the url A.
Url B, for itself, charges perfectly, and so far this is my mod_rewrite line:
RewriteRule ^pulseras-y-zapatillas-famosos\.html$ /tiendaweb/pulseras-y-zapatillas-famosos/culture/es.html [L]
that doesn't work :(
Hope some can give some tips! thanks!
In Symfony web directory have .htaccess file and you can add following code in first line. it's working for me. Hope this will solve your issue.
RewriteRule ^pulseras-y-zapatillas-famosos\.html$ /tiendaweb/pulseras-y-zapatillas-famosos/culture/es.html [L]

Resources