How to set permanent 301 redirect with htaccess?

Let’s learn how to set permanent 301 redirect with htaccess. The most accurate or helpful solution is served by Quora.

There are ten answers to this question.

Best solution

How can I set a 301 redirect to the www. directory in htaccess or CPanel for a wordpress site?

How can I set a 301 redirect to the www. directory in htaccess or CPanel for a wordpress site.

Answer:

I agree with Kashif Aziz, as the Redirection plugin is great. But really, if you're only making one...

Read more

Travis Quinnelly at Quora Mark as irrelevant Undo

Other solutions

.htaccess mod_rewrite 301 redirect help please?

Hi, I have more than 1 domain name for my site, I want all variations of both (i.e. domain2.com, www.domain2.com, domain1.com) to point to www.domain1.com this is what i have in my .htaccess file: Options +FollowSymLinks RewriteEngine on RewriteCond...

Answer:

Have you tried playing around with your DNS settings? This sounds like something that should be handled...

Read more

Renegade at Yahoo! Answers Mark as irrelevant Undo

How do I 301 Permanent Redirect with .htaccess when the TLD is different?

When redirecting an entire website using a .htaccess file, what is the proper code the the TLD (top level domain) is different? I need to make sure both the domain and all the subpages (which have the same names/url structure) redirect seamlessly. For...

Answer:

Yes, just tweak the domains in both lines: RewriteCond %{HTTP_HOST} !^www\.newdomain\.net RewriteRule...

Read more

Tim Fountain at Quora Mark as irrelevant Undo

Need php help with code to put in .htaccess for 301 redirect?

I'm new to php and could not figure out how to 301-redirect /index.php?main_page=index&cPath= to / and how to redirect /index.php?main_page=index to / Any experts on php? Thanks!

Answer:

You can do a 301 redirect in this case because you would get stuck in an infinite loop, redirecting...

Read more

KMJ at Yahoo! Answers Mark as irrelevant Undo

Syntax for page by page htaccess 301 Redirect

Do you know the .htaccess syntax for a page by page redirect from domain1.com to domain2.com domain2.com would be identically structured to domain1.com We want to ensure every page on domain1.com redirects to their corresponding page on domain2.com

Answer:

At the root directory of your old domain the htaccess file would look like RewriteEngine On RewriteCond...

Read more

Adam Bradford at Quora Mark as irrelevant Undo

Help with 301 redirect .htaccess?

I cannot get the script right. I am trying to modify a existing .htaccess. Can you tell me what code to put and where to put it in the coding? Thanks # Use PHP5CGI as default ...show more

Answer:

ErrorDocument 404 /index.html Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^yourdomain...

Read more

HHF4ESHFYS6KSGUGQU7BYSNIVE at Yahoo! Answers Mark as irrelevant Undo

How do I set up 301 redirect by excluding sub domain?

I am running 2 website, ex) 1, www . hoge . com 2, media . hoge . com Because (2) media . hoge . com is blog page with getting many social bookmarks feedback, I would like to keep it. I want to redirect (1) www. hoge . com only to new domain. - Is this...

Answer:

This article explains how to do it using .htaccess or PHP - non www .htaccess redirect - ignore other...

Read more

Yusuf Bhana at Quora Mark as irrelevant Undo

Complex htaccess question for Blogger to WordPress migration

I recently shifted the content management for my blog (www.sindark.com) from Blogger to WordPress. I shifted the Blogger version into a sub-directory, so that people who prefer to access old posts in that format can. Now, I want to use htaccess to automatically...

Answer:

The thing I notice immediately is that the caret should be at the begining of the rule. In RewriteRule...

Read more

sindark at Ask.Metafilter.Com Mark as irrelevant Undo

I just moved from Movable Type to a category-based Wordpress site and am now having redirect issues. Help me push my users to the right place!

I just moved from Movable Type to a category-based Wordpress site and am now having redirect issues. Help me push my users to the right place! I recently moved my site from Movable Type to a category-based Wordpress site (This is work related so I won...

Answer:

I've used this Redirection plugin successfully.

Read more

radiocontrolled at Ask.Metafilter.Com Mark as irrelevant Undo

How to do a 301 Directory Redirect?

I have an entire site devoted to Labrador Retriever Gifts as well as Dog Gifts site devoted to all 155 dog breeds. Now, I used to have a Lab section under the latter but want all links to anything in that section to redirect the user to the former (no...

Answer:

You cannot redirect from a client based on a 301 code. This is done from the server side. If you manage...

Read more

Shannon at Yahoo! Answers Mark as irrelevant Undo

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.