Redirect URL using htaccess - .htaccess

I have old URLs in my site and looks like this
http://www.example.com/forum/index.php/topic/
I want to redirect it to
http://'www.example.com/forum/index.php?/topic/

Try:
RedirectMatch 301 ^/forum/index\.php(/.+) /forum/index.php?$1

Related

Change Directory with Wildcard Redirect using RedirectMatch not working

I am trying to use a RedirectMatch to redirect all files under one directory to the main directory:
RedirectMatch 301 ^/question/.*$ https://www.sample.com/
So that if I have a URL like www.sample.com/question/what-day-is-it
It will automatically redirect to www.sample.com/what-day-is-it
The problem is when I put in the RedirectMatch like above, it redirects all URLs to the homepage: www.sample.com/question/what-day-is-it to www.sample.com
If anyone else had the same problem, a simple Redirect 301 /question / did the trick.

Using .htaccess to redirect to a subfolder

I'm trying to 301 redirect from '/en' or '/en/' to '/en/home' using .htaccess, but any attempt I do results into a redirection loop '/en/home/home/home/home/home/home...'.Shouldn't it be as simple as Redirect 301 /en /en/home?
Redirect based rule keep matching /en in redirected URL as well. You can use RedirectMatch for this with regex support:
RedirectMatch 301 ^/(en)/?$ /$1/home
Also make sure to clear your browser cache when you test this.
You have to use the full URL, example:
redirect 301 /folder_wrong/name.html http://website.com/folder-right/name.html

.htaccess to pass FULL URL into other PHP link as $_GET

From .htacces file, how to pass/redirect the FULL URL to another URL as GET Variable?
Like:
http://www.test.com/foo/bar.asp
will be redirected to:
http://www.newsite.com/?url=http://www.test.com/foo/bar.asp
With Full Url with Domain.I tried:
RewriteEngine on
RedirectMatch 301 ^/(.*)\.asp http://www.newsite.com/?url=%{REQUEST_URI}
But it is going out like:
http://www.newsite.com/?url=?%{REQUEST_URI}
RewriteEngine on
RedirectMatch 301 ^/(.*)\.asp http://www.newsite.com/?url=$1.asp
If the initial domain and protocol is always the same then you can use
RedirectMatch 301 ^/(.*)\.asp http://www.newsite.com/?url=http%3A%2F%2Fwww.test.com%2F$1\.asp

Magento 301 htacess redirect not working at all

i am writing a 301 redirects via htaccess redirect old traffic to new urls
ex
i have old url
http://www.thebedroom.com.au/catalogue/accessories/product134
i need to redirect this request to
http://www.thebedroom.com.au/melbourne-demons-bean-bag-cover.html
so i wrote a code on magento httpacess like below
Redirect 301 http://www.thebedroom.com.au/catalogue/accessories/product134 http://www.thebedroom.com.au/melbourne-demons-bean-bag-cover.html
no luck
and also tried
Redirect 301 ^accessories/product134 http://www.thebedroom.com.au/melbourne-demons-bean-bag-cover.html
but this not redirectoring and show the same url on browser window.
anyone know what is the issue here
thank you
Try:
Redirect 301 /catalogue/accessories/product134 http://www.thebedroom.com.au/melbourne-demons-bean-bag-cover.html
or
RedirectMatch 301 product134 http://www.thebedroom.com.au/melbourne-demons-bean-bag-cover.html
which will redirect if there's any instance of product134 in the URI.

301 redirect from htaccess

I'm trying to create permanent redirects for outdated URL's on my site.
For example I have: www.mydomain.com/?v=tv and want it have a permanent 301 redirect to www.mydomain.com/tv.php
I tried this code in my htaccess file but it did not work:
Redirect /?v=tv http://mydomain.com/tv.php
Any Help?
RewriteRule ^tv.php$ http://guessthelogo.com/?v=tv [R=301,L]
I think your missing "301" after "Redirect":
Redirect 301 /?v=tv http://guessthelogo.com/tv.php

Resources