.htaccess 301 redirect with trailing ? in URL - redirect

any assistance on this redirect question is appreciated. I am adding several redirects from an old url to new pages on a website. Several of the old urls that are indexed have a trailing ? in the url. www.example.com/products/1234?
I have the following redirect in place that does not work
Redirect 301 /products/1234? http://www.example.com/test/
If I remove the question mark above the redirect does work, however it then adds in a question mark to the url it's redirecting to. http://www.example.com/test/?
How do I get this to redirect without it displaying a ? in the URL?

Related

Cloudflare page rules using wildcard redirect

I wanted to redirect all old blog URLs to the new ones.
www.mysite.com/blog/anything-here should redirect to www.mysite.com/anything-here.
Basically, all URLs that have "blog/" should be redirected to the new URL which is without the "blog/"
I have tried it on Cloudflare page rule by using
mysite.com/blog/* to mysite.com/$1
It is working fine but if you visit mysite.com/blog only it redirects to mysite.com which it shouldn't be happening.
How should i set my redirect pagerule?

301 redirect only 1 page and not all it's sub pages

Currently I have this redirect
Redirect 301 /partners https://mysomesite/ecosystem
So it redirects correctly by redirecting https://mysomesite/partners to https://mysomesite/ecosystem
But now I have an issue with all the content under /partners/
Now these pages are linking to broken pages. I do not want this to happen.
https://mysomesite/partners/title1/ to https://mysomesite/ecosystem/title1/
https://mysomesite/partners/title2/ to https://mysomesite/ecosystem/title2/
So how to I redirect /partners/ without all its content underneath of it getting redirected also?
Redirect directive appends rest of the old url path to its destination url and it can't be avoided.
If you don't want the trailing path to be appended to your new url and to redirect /partner to a specific location, you can use RedirectMatch .
RedirectMatch 301 /partner/?$ http://example.com/ecosystem
Clear your browser cache before testing this.

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.

301 redirect wrongly applied. Is it ok to change to a new redirect?

I'm taking over a website which recently had its entire urls changed. Instead of applying a 301 redirect from each old page to its new corresponding page, the entire site was redirected to the new home page.
Would it hurt to undo this 301 redirect and have the correct ones applied instead?
Thanks!
I don't think it will hurt. Your new changes will only be applied to new requests of the old site though.

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!