[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

,htaccess 301 redirect

Posted on 2016-10-03
10
Medium Priority
?
56 Views
Last Modified: 2016-10-31
Hello,

What will be 301 redirect code in .htaccess for:

abc.com/html/xyz/oxo.html   To >   abc.com/asd/qwe/luv/

Thanks.
0
Comment
Question by:tahirr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 35

Assisted Solution

by:Terry Woods
Terry Woods earned 2000 total points (awarded by participants)
ID: 41827391
Assuming that the path is fixed, try this:
RewriteEngine On
RewriteRule ^html/xyz/oxo\.html$ /asd/qwe/luv/ [R=301,NC,L]

Open in new window


If parts of the URL are variable, you'll need to indicate which ones.
0
 

Author Comment

by:tahirr
ID: 41827404
Thanks Terry for a super fast reply. Moved the hosting few hours ago and propagation should be done soon then I will try your suggestion and let you know.

Thanks.
0
 

Author Comment

by:tahirr
ID: 41828248
Good Morning,

I have tried this code now and it does not redirect :(
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 35

Accepted Solution

by:
Terry Woods earned 2000 total points (awarded by participants)
ID: 41828705
Ok, there's a process to go through when it's not working as expected.

The first parameter to RewriteRule is a pattern for matching the URL. We can relax the pattern until we do get a match, and then tighten it up again once we understand why.

I find when I'm testing these rules in Chrome it tends to cache or remember redirects that have previously been applied. What seems to help is to open a new Incognito/Private window each time I test a pattern. Once the page has redirected, I close all Incognito tabs/windows and open a new one to do a fresh test. You might like to try this technique too.

Firstly, try this:

RewriteEngine On
RewriteRule (.*)/oxo\.html$ /asd/qwe/luv/?from=$1 [R=302,NC,L]

Open in new window


The .* part of the pattern matches anything, so provided you try to access anything ending with /oxo.html it should redirect. If not, then it's not the RewriteRule that's going wrong.
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 41828706
Note that you should test this kind of thing on a development server before putting it live.
0
 

Author Comment

by:tahirr
ID: 41829049
Thanks for your time and detailed explanation. I will try your suggestions tonight and let  you know how it went.

One confusion if you could clear will me it even easier for me. If we redirect the old page by placing html 301 redirect code in header. Will it still transfer the SEO juice to new page or will it effect it? Do you think 301 redirect works the same in either .htaccess or css redirect or html redirect?

Thanks.
tahir.
0
 
LVL 35

Assisted Solution

by:Terry Woods
Terry Woods earned 2000 total points (awarded by participants)
ID: 41829054
If you're talking about using an HTML header refresh, then in my understanding that isn't a 301 redirect, so no it won't transfer the SEO. You need to use the .htaccess.

For a live page, you should always test with a R=302 (temporary redirect) until you're sure you've got it right, otherwise you can permanently send traffic to the wrong place. 301 = permanent.
0
 

Author Comment

by:tahirr
ID: 41829063
Thanks
0
 

Author Comment

by:tahirr
ID: 41867735
I am sorry for not posting my results. Human nature, we come back to check on status when need help and get lazy once problem is solved. : (

I was not able to use your code, for some reason it was not working. My site had gone live for two days at the point and I was in panic mode to loose SEO juice and did not want to risk that by waiting for further solution. I found a plugin for wordpress and it did solve my issue.

I am sure the information in this post will help someone in the future. It could be me making some mistake trying to implement it.

Thanks for your help. Kudos. : )
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question