In Google search console, I have 3 url's that will not redirect. They are all facebook url's and are similar to this:
Redirect 301 /author/amy/feed/%20www.facebook.com/heatfinders https://www.facebook.com/heatfinders
I'm pretty sure its something to do with the '%' in the url. Still getting a 401 instead of it going to the correct Facebook page.
You can use RedirectMatch and \s to match a space in the uri.
RedirectMatch 301 ^/author/amy/feed/\swww\.facebook\.com/heatfinders$ https://www.facebook.com/heatfinders
Related
I need to create a 301 redirection from myOldSite.com to myNewSite.com
I have this code in the htaccess in myOldSite.com
#Redirect 301 / https://myNewSite.com/myPage/
This works fine to redirect myOldSite.com but it does not work to fire the right redirection for myOldSite.com/services.html:
myOldSite.com is properly redirected to myNewSite.com/myPage
But
myOldSite.com/services is redirected to myNewSite.com/myPage/services.html This is wrong.
As you can see servicesis appended to the end. This is not what I need. I need:
myOldSite.com/services to be redirected to myNewSite.com/myPage
Any url which start with myOldSite.com/ANYTHING_HERE should be redirected to myNewSite.com/myPage
Use RedirectMatch
RedirectMatch 301 / https://myNewSite.com/myPage
This will not append the old URL subpath to the destination URL.
The URL I'm working with is something like this...
old-website/directory/sub-directory/last-directory
I need to capture just the sub-directory portion and then use that in a URL for a redirect. For example, redirect to new-website/working/sub-directory/page
However, I also need a redirect that works for old-website/directory/sub-directory to redirect to the same new-website/working/sub-directory/page
You can use this RedirectMatch rule in your root .htaccess:
RedirectMatch 302 ^/directory/([^/]+)(?:/.*)?$ http://working/$1/page
Change 302 to 301 once you verify that rule is working fine.
I'm trying to redirect http://brisbaneamazingrace.com.au/details.html to http://www.teambonding.com.au/activities/amazing-race-brisbane which is a different domain. In my .htaccess file I have
Redirect 301 http://brisbaneamazingrace.com.au/details.html http://www.teambonding.com.au/activities/amazing-race-brisbane
But the redirect goes to http://teambonding.com.au/activities/amazing-race-brisbanedetails.html
It keeps adding the details.html to the end of the redirect url. Whats up with that?
You should use RedirectMatch for regex matching:
RedirectMatxh 301 ^/details\.html$ http://www.teambonding.com.au/activities/amazing-race-brisbane
Also test this after clearing your browser cache.
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
I'm using ExpressionEngine and it is generating a URL like this when viewing a specific category:
domain.com/index.php/template_group/template/category_URL_indicator/foo_category/
I would like to redirect visitors if they delete the specific category from the final segment of the URL. For example, if they made the URL this:
domain.com/index.php/template_group/template/category_URL_indicator/
I tried an .htaccess 301 redirect but redirecting the shorter URL also redirected the longer URL. That is, if I put this in .htaccess:
redirect 301 http://www.domain.com/index.php/template_group/template/category_URL_indicator http://www.domain.com
This also redirected the longer URL to become http://www.domain.com/foo_category/ - not what was required... Any suggestions welcome - thanks!
David.
Try using redirect match instead, along with begin/end boundaries:
redirect 301 ^index.php/template_group/template/category_URL_indicator$ http://www.domain.com