A permanent 301 redirect in your .htaccess file lets search engines and others know that a old link has been replaced by a new one. It's the recommended method for directing traffic from an existing page.

Some common uses of a 301 .htaccess redirect:

You have the ability to setup redirects for a domain in your cPanel interface one at a time, or following the steps below you can modify your .htaccess file directly to add these manually yourself.

Getting to your .htaccess file

On a Linux server you would use your .htaccess file to implement a 301 redirect for your pages.

  1. Login to your cPanel.
  2. Under Files, click on File Manager.
  3. Select the Document Root for: option, and choose your domain from the drop-down.
  4. Ensure that Show Hidden Files is selected.
  5. Then click Go.
  6. file-manager-hidden-files
     
  7. Right-click on the .htaccess file and select Edit.
  8. file-manager-htaccess-edit
     
  9. If your .htaccess file didn't exist already during the previous step, click on New File at the top-left, name the file .htaccess, and finally set the directory for the file to be created to /public_html/ or the document root of your site.
  10. file-manager-htaccess-create
     
  11. You might have a text editor encoding dialog box pop-up, you can simply click on Edit.
 

Redirect individual files

To redirect individual files, like example.com/oldfile.htm to newfile.htm you can use a 301 redirect like this:

Redirect 301 /oldfile.htm /newfile.htm

single file 301 redirect

To redirect one specific file to another domain such as example.com/oldfile.htm to example.net/newfile.htm:

Redirect 301 /oldfile.htm http://example.net/newfile.htm

single file domain 301 redirect

Redirect an old domain to a new domain

If you had an old domain such as example.com, and now you decided you actually want to use example.net for the website. You could setup a 301 redirect for the entire domain, so that old links to example.com carry over.

Code in the example.com domain's .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]

full domain 301 redirect

Force www. version of domain to be used

A search engine like Google would see example.com and www.example.com as essentially two separate websites. They recommend you pick one version you'd like search engines to display and using a 301 redirect is a possible option.

If you have a lot of links on the web where people are linking to your site as example.com, but you would like your visitors to instead end up at www.example.com you can force this version of your domain with these rules:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]

force www 301 redirect

Force non www. version of domain to be used

If you have a lot of links on the web where people are linking to your site as www.example.com, but you would like your visitors to instead end up at example.com you can force this version of your domain with these rules:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]

force non www 301 redirect

Redirect all files with certain extension

To re-direct all of one type of file to another, such as example.com/file.php to example.com/file.htm

RewriteEngine On
RewriteCond %{REQUEST_URI} .php$
RewriteRule ^(.*).php$ /$1.htm [R=301,L]

file extension 301 redirect

You should now know how to properly setup 301 permanent redirects on your website to help ensure that search engines and visitors coming to your site from older links can still get to your new content.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
n/a Points
2014-05-03 11:01 am

Need a solution to this, not addressed above.  Want to redirect all "example.com/shop" to "www.example.com/shop" pages.  Our SSL certificate covers "www" pages on our shopping cart (i.e. "www.example.com" not "example.com").  On occasion, customers will try to go to a cart page without the "www" prefix and get a warning notice because certificate doesn't cover those pages.  Cart settings usually force the "www" but occasionally fail and/or need to be reset.  

Have tried to create a redirect, but keep getting "loop" errors.  Above discussion doesn't address this specifically.  Any help would be appreciated.

Staff
10,317 Points
2014-05-05 8:57 am
Hello Raplh,

Thank you for your question. We have a general guide on How to force www or non-www in htaccess.

What program are you using to build your website? Depending on your CMS, you may a have to accomplish this a different way. For example, in Wordpress, you would change the site URL from http://example.com to https://www.example.com.

If you have any further questions, feel free to post them below.
Thank you,

-John-Paul
n/a Points
2014-09-19 6:23 am

If i enter www.domain.com then must i have www.domain.net aswell ? or only it rewirte and use my www.domain.com's root ?

Please solve my confusion..

Staff
20,166 Points
2014-09-19 8:42 am
Hello,

You do not have to own both .net and .com. However if you want to have .net redirect to .com or vice versa, then you will need to own both domains.

Kindest Regards,
Scott M
n/a Points
2014-06-08 12:48 pm

Please provide me solution

 

I want to redirect my site from

http://bluemoonacres.net/in-our-markets/

to

http://bluemoonacres.com/in-our-markets/

For all my websites link

 

Please Please Please

Iam stucked

Staff
20,166 Points
2014-06-09 12:16 pm
Hello Pardeep,

If you are simply wanting to redirect the .net to the .com, you will want to follow the instructions for redirecting from old domain to a new domain. You can simply add the /in-our-markets/ to the end of the domain names to assist with the redirects.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com\/subfolder [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com\/subfolder [NC]
RewriteRule ^(.*)$ http:\/\/example\.net\/subfolder\/$1 [L,R=301,NC]


Kindest Regards,
Scott M
n/a Points
2014-06-13 8:19 am

Thanks, it helped me a lot.... I wanted to redirect all old links from asp pages to php pages, and the article "Redirect all files with certain extension" almost worked, except that it would redirect to the root site for links within subfolders...

for eg: i would like to redirect http://examplesite.ext/sub/page1.asp to http://example.ext/sub/page1.php

But the code shown here redirects to http://example.ext/page1.php

please help

Staff
9,479 Points
2014-06-13 9:15 am
The following code will allow you to redirect but keep the folder structure:

RedirectMatch 301 (.*)\.asp$ http://www.example.com$1.php

n/a Points
2014-10-02 2:31 pm

Having an issue with this on inmotionhosting.com servers

if I use this RewriteRule   ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ /page.php?c=$1&t=$2

the url in the browser shows www.mysite.com/Category/Pagetitle which is what I want

When I add the 301 like thisRewriteRule   ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ /page.php?c=$1&t=$2 [R=301,L]

the url in the browser shows www.mysite.com/page.php?c=Category&t=Pagetitle

this is not what I want.

How do I keep file stucture correct in the browser window as well as making it a 301 on inmotionhosting server?

 

 

Staff
10,317 Points
2014-10-23 5:40 pm
Hello sean,

Thank you for contacting us today. We are happy to help, but need some additional information.

What are you trying to accomplish by adding the 301 redirect?

Thank you,
John-Paul
n/a Points
2014-06-18 10:51 pm

I want to move my site from a nation domain to .com domain, could you suggest me to do it. 

it's is www.lacda.vn and move to www.muhato.com

Staff
9,479 Points
2014-06-19 8:22 am
You would simply need to buy the new domain if you have not already, and add it to your cPanel as an addon domain or perform a primary domain change on your account. Depending on how your site is built, you may also need to make some additional configuration changes if anything is referencing the old domain directly.
n/a Points
2014-06-30 3:06 pm

Good afternoon,

I have create some subdomains for my basic domain. Because I have an SSL card only for principal store, I want that the all login page, registered page and sign-up page and check-out page from all sub-domains to be redirect on basic store. Some example of links are:

- https://mysite.com/login.html (login page from basic store)

- http://sub-domain-1.mysite.com/login.html  (login for sub-domain 1, corresponding to login page)

- http://sub-domain-1.mysite.com/?route=account/signup (signup for sub-domain 1, corresponding to signup page)

- http://sub-domain-1.mysite.com/create-account.html (register for sub-domain 1, corresponding to register page)

- https://mysite.com/checkout.html (check-out page from basic store);

 

Also, I observe that on my home page from basic store don´t appear https on browsers. How I can allow to appear https on home page, also using .httaccess file?

Thank you very much for your advice and support.

I waiting your advice.

Best regards.

P.S. I use OpenCart 1.5.6, multi-store (under the same admin, multiple stores)

Staff
17,836 Points
2014-06-30 4:19 pm
Hello Johnny P,

SSL certificates are made to work with a specific URL. So, if you order it to go to "https://mysite.com", then all sites in that URL should be secure. However, since you're using a different URL than what was specified for the SSL, the certificate does not protect it. The URL that you mentioned above (sub-domain-1.mysite.com/login.html ) will not work because it is not formatted for the SSL that was purchased. However, there is a way to use the subdomains in this way as long as they are using the primary domain.

If you were to use a Wildcard SSL (you would have to specify that during the purchase of the SSL), then you could use the subdomain format that you're using:

subdomain.mysite.com

However, if you're using 2 different URLs (you mentioned a principal store and a basic store), the SSL will not work that way. You would definitely need to purchase 2 different SSL certificates.

I hope that helps to clarify the answer. Please let us know if you require any further assistance.

Regards,
Arnel C.

n/a Points
2014-06-30 11:54 pm

Good morning,

Thank you for answer Arn.

I know this basic detail reffering to SSL Wildcard. Fortunately, OpenCart share the same details for all their sub-domains. This Is the reason because only I want to redirect some basic links (such I specified anterior). When somebody want to login on my some sub-domains, than automatic will be redirected on the corresponding page from basic store (is the same think as principal store, but in other words).

I can redirect those link using file 301 and htaccess? What is the command line which I can add it to ensure redirection? Also I don´t have in my ftp the 301 file.

Thank you for support and advice to all comunity.

I waiting your answer.

Best regards.

Staff
20,166 Points
2014-07-01 9:10 am
Hello JohnnyP,

If I am correct, you are asking if it is possible to redirect http://login.example.com to https://example.com/login. This can absolutely be done via the htaccess file, but it can be done even easier via the redirect tool for cPanel. This writes the .htaccess code for you. I have tested this on my own server and it worked perfectly.

Kindest Regards,
Scott M
n/a Points
2014-07-01 12:54 pm

Hello

I moved my site from ASP to WordPress an I need to redirect any .asp page to the site root. I tried with this code but it doesn't work

RewriteEngine On
RewriteCond %{REQUEST_URI} .asp$
RewriteRule ^(.*).asp$ /$ [R=301,L]

$nbsp;

Any help will be welcomed

Redards

Staff
9,968 Points
2014-07-01 2:58 pm
Hello Ciro,

You would more than likely want to insert your rewrite rule inside the default WordPress .htaccess rules like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.asp$ /index.php [R=301,L]
RewriteRule . /index.php [L]
</IfModule>
# END WordPress


Please let us know if that is working for you.

- Jacob
n/a Points
2014-07-02 4:32 pm

Thanks Jacob!

Staff
9,968 Points
2014-07-02 6:03 pm
Hello Ciro,

No problem at all, glad to help out!

Taking a closer look at this, it looks like I might have given those rules to you in haste. While it does seem to technically force all requests for a .asp page to your main WordPress page, it looks like it also possibly breaks the inclusion of CSS files and images.

So you would want to use the redirect code above your default WordPress rules like this instead:

RewriteEngine On
RewriteRule ^(.*)\.asp$ / [R=301,L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress


Also as I've answered Heidy's question below about the SEO impact of directing old URLs to new ones. You might also want to think about directly setting up a 301 redirect if you've got the same content just in WordPress now.

Redirect 301 /helpful-page.asp /helpful-page


Please let us know if this works out for you!

- Jacob
n/a Points
2014-07-02 1:46 pm

Hello,

I appreciate very much your help to solve the following issue.  

There is already a live site created long ago in Dreamweaver with .htm and .html files. Recently, I created a completely new site with Joomla 2.5 in a subdirectory under the same root directory of the old site.  My intention now is:

1) Redirect all trafic to the subdirectory where I have the new joomla site, using the same domain.

2) I will keep the old site as it is, but I need to redirect old .html and .htm pages to the new corresponding pages in joomla 2.5 to avoid loosing ranking position in search engines.

3) I am concern that redirecting old pages to new pages would be a bad practice for search engines like Google.  I want to make sure that this will not be a problem, and if it is, then what it is the correct way for doing it.

I appreciate your help and explain how to do the above.

Thank you very much.

Staff
9,968 Points
2014-07-02 3:58 pm

Hello Heidy,

Luckily you can redirect your old .htm and .html pages to your new Joomla site, and won't lose any search engine ranking in the process when done correctly.

Search engines use the 301 redirect from a server to update their indexes to make sure they link to your fresh content. Search engines love it when you let them know a old helpful page can now be found at a new home. It helps their users get the most relevant and up to date content, and lets the search engine know you have someone maintaining your site and updating things.

Here is a great page from Google on 301 redirects and why you want to make sure to use it when updating your content. Hopefully that will help put you a little bit at rest for worrying about search engines not liking you updating your links.

Now do keep in mind from a SEO or Search Engine Optimization stand-point, if you're getting a lot of traffic to your HTML page about "how to use a PC". Then you go and completely change the content that was in your HTML page on the Joomla version, for instance you update it with tips on "how to use a Mac" and removed some of the PC information you had before. Over time you could lose ranking for the "how to use a PC" keyword phrase, because search engines care about relevant content and the reason people used to click on your page from Google results might not be there anymore.

To redirect all of your old HTML pages to your new Joomla subdirectory, you would simply edit your .htaccess file and use one of the following formats:

Redirect 301 /helpful-page.htm /joomla/helpful-page


Or include the full URL:

Redirect 301 /helpful-page.htm http://example.com/joomla/helpful-page


I hope that helps, and if you have any further questions at all, please let us know!

- Jacob
n/a Points
2014-09-27 12:23 am

Hello, 

Great post and I read the conversation but unfortunately as far as I can see my question has not been answered.

My site structure changed so now the paths are different. Does this command also work for changed paths?

 

Redirect 301 /natural-hairstyles /black-natural-hairstyles

 

Staff
10,317 Points
2014-10-23 3:43 pm
Hello simplesite,

Thank you for contacting us. The code you provided will redirect people trying to access the /natural-hairstyles folder, to the /black-natural-hairstyles folder instead.

If this is what you want to accomplish, it is correct. If this is not what you are trying to do please provide more details on your goal.

Thank you,
John-Paul
n/a Points
2014-07-02 4:10 pm

Perfect!  Thank you very much for your prompt response.  

Staff
9,968 Points
2014-07-02 4:29 pm
No problem Heidy, thanks for stopping by and commenting on my guide :)
n/a Points
2014-07-07 10:35 am

Hi!

How can i redirect joomla subdirectory to article ? Like mypage.com/subdir -> mypage.com/index.php/article=1

Staff
20,166 Points
2014-07-07 10:49 am
Hello Punkel,

The best way to do that would be to use the cPanel redirect tool. It will write the code for you and place it into your .htaccess file.

Kindest Regards,
Scott M
n/a Points
2014-07-07 3:36 pm

Thank you, but my site does not have cPanel. Can you paste here .htaccess example?

Staff
9,968 Points
2014-07-07 3:50 pm
Hello Punkel,

You would simply add this towards the top of your .htaccess file:

Redirect 301 /subdir /index.php/article=1



However further down the file, you'll need something that handles the rewrite of that /index.php/article=1 to actually do something. As article=1 is not a valid URL when just used like that as it would essentially be the same as requesting /folder-name=1 and most of the time you aren't going to have a folder or file with a = symbol in it.

Typically you're going the reverse where you want to go from a URL like /index.php?article=1 and make it a search engine friendly URL like just /page-name.

- Jacob
n/a Points
2014-07-08 1:59 am

Thank you a lot, this Redirect 301 /subdir /index.php/article=1

works perfectly. I use this redirect only for search bots.

Staff
9,968 Points
2014-07-08 2:10 am
Hello Punkel,

Awesome, glad that helped! It's still a little odd to see a search friendly URL being converted back to a numbering system. So if you happen to be trying to block bad bots for some reason with this redirect, you would find my guide on block users with .htaccess helpful, or even how to identify bad bots.

I hope you're not having a malicious bot issue, and just need to redirect to that URL format for some other reason instead. If so, again I'm glad it helped!

- Jacob
n/a Points
2014-07-08 1:26 am

Hello,

Good Morning

My Site is single page site that's and my Domain is http://example.com/#!/ and i have to convert this domain to http://example.com using 301 redirect then which code i have to use?

Staff
9,968 Points
2014-07-08 3:00 am
Hello Rinku,

You wouldn't be able to use a 301 redirect, or to my knowledge any RewriteRule rule to be able to alter the URL like that.

The pound symbol # doesn't actually go to the server for processing, it is all handled by the front-end. You can confirm that if you have access to your website's access logs and look at the request. So either the browser interprets it as an anchor link and navigates the user to a specific spot on the page. Or JavaScript grabs it and interacts with the browser's DOM in some fashion.

If you hit Ctrl-U in your web-browser you can see the HTML of your page, and you should notice this on the 4th line:

!-- Mirrored from example.com/index.html by HTTrack Website Copier/3.x



So it looks like this one page website might have been copied from another server, and in doing so, looks like it retained a bunch of links including #! already for switching to multiple pages of info when a link is clicked.

It looks like your /js/switcher.js file is responsible for this:

defHash:'#!/',
emptyHash:'#',



So it looks like this switcher JavaScript file is causing the #! part of the URL to show up in the browser more than likely. But the web page is using it for navigation, so if you simply tried to remove it, it would also remove the functionality of your links pulling up the different pages of the one HTML page.

Hope that helps, please let us know if you had any further questions.

- Jacob
n/a Points
2014-07-16 4:20 am

My website opening with "www" and without "www"  -- I want my website always open without "www" if some one open with "www" it should be redirect in without "www" - please inform me - how can i solve this problem - website made in PHP . thanks

 

Staff
9,968 Points
2014-07-21 7:21 pm
Hello Shashi,

You can use the .htaccess rules mentioned above from the force non www example in this guide:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]



This will force all requests for www.example.com to instead just redirect to example.com without the preceding www at the beginning of the domain.

Please let us know if you needed anything else at all.

- Jacob
n/a Points
2014-07-28 5:05 pm
stop creating cartoons and create a text-only step-by-step version
Staff
9,968 Points
2014-08-01 3:29 pm
Hello Stu, and thank you for your suggestion.

There are already many text-only versions out there that cover 301 redirects on the Internet, was there a specific way of redirecting you were unable to figure out by following the current text with animations on this guide?

In my experience I've found that most people when they are writing rewrite code want to know what the end result is going to do in their web-browser. I thought there would be no better way to show that then literally showing what happens when you activate a particular rewrite rule and then watch it in the browser to see what it does.

- Jacob
n/a Points
2014-07-28 8:30 pm
Give more explanations
Staff
9,968 Points
2014-08-01 3:34 pm
Hello shregs, and thanks for your comment,

Was there any particular examples you were looking for, or what in your opinion could use more explanation to be easier to understand?

- Jacob
n/a Points
2014-08-01 3:21 pm

I have a website that I am working on that had multiple domain names because we have multiple companies. They were all leading to the same website, but with different URL addresses. I didn't want a duplicate content issue, so I redirected all of the multiple domain names to the main website name since we rebranded about 6 years ago and the last webmaster didn't do any 301 redirects from the old domain to the new one. I am also trying to get the link juice from those domains and recover the history of the last domain because we still own it and it's 15 years old as opposed to the current domain that is 6 years old. Will Google penalize me for doing this or is this the positive step for my SEO? Also, do you know how long it will take to get the history of old domain to merge with our newer domain? Any help is apprecaited

Staff
9,968 Points
2014-08-01 3:58 pm
Hello Joy,

It would really depend on the niche that your website is in, but for the most part having multiple domain names pointing to the same website content is not going to help you SEO wise. In some cases it can hurt you by getting penalized for duplicate content as described by Google.

It would help to get a better understanding of exactly what you're trying to do before we could offer an real recommendation as to what you might want to do. I'd recommend checking out the Google Webmasters page about change page URLs with 301 redirects it also has a good video on it from Matt Cutts at Google talking about when you might want to use a 301 redirect.

In order to get link juice from an old domain, if you had a page like example.com/how-to-tie-a-tie that was ranking well for the search query how to tie a tie, then you'd want to make sure that you're passing on that ranking to your new domain with a 301 redirect. So you would have it go to a matching URL on your new domain such as example.net/how-to-tie-a-tie that also contains related info to what the old domain had been ranking for.

In regards to your questions about older and newer domains, those don't really hold as much weight as they use to in the SEO world. It's really more about the content of your website as opposed to the domain they are hosted on. If you're currently ranking high for something on a newer domain, setting up a 301 redirect for it to now be on an older domain isn't going to really give you much of a boost if any at all.

If you can be more specific in your question with examples of exactly what you're attempting to do we can attempt to provide you a better answer for your specific situation.

- Jacob
n/a Points
2014-08-01 4:18 pm

Thanks Jacob,

I already read everything that I could find about it. I am not talking about recovering pages since our old website is long gone as are the pages and I don't know the page names or extentions to redirect anyway.

When we changed our company name, they changed the domain name of the website without doing a 301 redirect. They did however, set up the server host to redirect customers from the many domain names to the current one. They also already had the multiple domain names that went to the same site, but with a different URL.

The reason that I am trying to do a 301 redirect is because I don't want a duplicate content issue. I want Google to see it as all one website and one domain that was permanently moved. 

I also want to obtain the link juice since they are our domains and they do point to the same site. Does that make sense? The domain names are all our company names and they are not the same, but they are all owned by us and go to that site anyway.

Staff
9,968 Points
2014-08-01 4:49 pm
Hello Joy,

You could probably look at your old site's access logs and see what URLs are still being directly accessed, and then 301 redirect those over to relevant pages on your new site.

If you just wanted to 301 redirect all your old sites to the main landing page of your new site, that should be fine, but you're not going to really get any SEO benefits out of that. As essentially you're telling search engines, this old piece of content that my old site is ranking for about how to tie a tie is now on this new website, but then when the bot gets to the new website there is no information about that search term. So over time if you were ranking for that topic and people are seeing that content no longer exists you'll drop in the search engine rankings for that term.

We would really need a direct example of what it is your're trying to accomplish with your sites to give you a good recommendation. I don't quite understand what it is you're trying to accomplish just by your explanation but if you could give us some real world examples I'm sure we could help you out.

- Jacob
n/a Points
2014-08-01 5:25 pm

As an example: (These are not the real website URL's and if they are, then they weren't used by for the purpose of example only)

We had a company www.movingcompany.com and they were affiliated with a larger company www.vanlines.com, but not owned by that company, but rather an "agent" of that company.

Then www.vanlines.com got purchased and merged with www.biggervanlines.com and we respresented both sides (2 companies) and had two company names www.movingcompany.com (agent of www.vanlines.com) and www.othermovingcompany.com (agent of www.biggervanlines.com)

We also had other devisions of our company like www.recordstorage.com, etc... I don't know who's great idea this was, but this is what I'm working with here lol. And there are about 4 of these.

Then 6 years ago we decided that it was too much and changed our domain to www.movingcompanies.com to represt all of it under one name. I wasn't a part of any of that decision making. I'm just trying to optimize and recover what may have been lost 6 years ago because proper 301 redirects weren't done.

When we changed our domain name, they didn't do any 301 redirects from the old sites to the new site in the .htaccess file. They only redirected through the server host. So the domains are there, but they all have different URLs that take them to the same landing page www.movingcompanies.com (the new site)

Each domain has internal and external site links pointing to and from the domain. What I am trying to do is get www.movingcompanies.com to be reconized by Google as the same domain so that the past links from the old websites are credited to the new website. I just wanted to confirm that 301 redirects were the best possible way to do this or if I should even bother at this point.

Staff
9,968 Points
2014-08-01 5:40 pm
Hello Joy, thanks for the examples.

Going the 301 redirect route would be how you'd want to transition all of the old domain names to your main new one, and to also let Google and other search engines know about the transition.

However because you're talking about sites that are 6 years old and I'm assuming have different content on the new site, you're not going to really see a SEO benefit for keywords driving traffic to your sites.

For instance in your example if your vanlines.com site is currently ranking on the first page of Google for van moving, and your biggervanlines.com site is ranking for big van moving. If you 301 redirect all requests for these 2 domains to the same front landing page on your movingcompanies.com domain, but you don't have the same content for van moving on that page that allowed your old site to rank well, just setting up a 301 isn't going to make the new site rank any better for that term.

Basically if past links from your old sites aren't relevant to the new site, setting up a 301 redirect will allow people to get to the new site but if the content isn't the same as when it was on the old site it's not going to bring SEO benefits to your new site.

- Jacob
n/a Points
2014-08-01 6:02 pm

Thank you. The content is basically the same. It's a new/old webpage, but they are all moving companies and moving related and because this happened 6 years ago, these domains aren't ranking in Google as webpages. They are only old and there. I'm hoping that the link value will merge because they all essentially link to where the user would want to go. Which is to the moving company that just happened to change domain names awhile back. I appreciate all of your input and help.

n/a Points
2014-08-04 7:11 am

hey Jacob, I am using the followingrewrite rules:

RewriteEngine on

RewriteRule ^courses/chemistry/5-13-organic-chemistry-ii-fall-2003/(.*)$ http://hdl.handle.net/123456789/286 [L,R=301]

RewriteRule ^courses/chemistry/5-12-organic-chemistry-i-spring-2003/(.*)$ http://hdl.handle.net/1721.1/86886 [L,R=301]

but i need to do the deep linking and get the result like :

http://dspace.mit.edu/bitstream/handle/1721.1/86886/20-320-spring-2006/contents/index.htm

how can i fetch the 20-320-spring-2006(shortname for URL) and index.htm after the slash(/) dynamically.

Please suggest a way and help me out. Kindly give us a code as a example using my data.

What is the best practice to write a rule in .htaccess file, whether we should write all the redirects in on .htaccess file or we can write it in different .htaccess files for different folders.?

 

Staff
20,166 Points
2014-08-04 11:17 am
Hello Abhishek,

I am not quite following your request. Are you saying you want to redirect: http://dspace.mit.edu/bitstream/handle/1721.1/86886/* (meaning anything under the 86886 dierectory) to a specific place?

Kindest Regards,
Scott M
n/a Points
2014-08-08 4:07 am

Hi,

Can you help on my issue? My website's same content is available via 2 URLs: like http://domainname.com/ and http://XXX.XXX.XXX. XXX opens same content. Similarly it is happening for all internal pages also: http://XXX.XXX.XXX.XXX/internal-content-url/ and http://domainname.com/internal-content-url/ opens same content and google thinks it is duplicate content and drops my site ranks.

I am using dedicated IP on a dedicated server and WordPress CMS

I tried to write redirection URL in .htaccess file but it worked for homepage only not internal pages.

Any advice will be deeply appreciated.

Staff
20,166 Points
2014-08-08 9:26 am
Hello Anshit,

You can 301 the IP address to the domain name. You may want to try the following code as a template. (Assume an IP address of 123.45.67.89 and a domain name of example.com)

RewriteCond %{HTTP_HOST} ^123\.45\.67\.89$
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

Kindest Regards,
Scott M
n/a Points
2014-08-08 3:29 pm

Thanks for your reply Scott,

I am using the same code in .htaccess file but it is redirecting only the home page. Not the internal pages. 

Staff
10,317 Points
2014-08-08 4:19 pm
Hello Anshit Gupta,

Check to make sure there are not other .htaccess files within your subfolders. This would cause them to override the rules you are creating in the folder above.

Also ensure there are not other rules within your .htaccess, interfering with this redirect. For example, CMS's typically include a list of rules, and can add more rules from plugins/addons.

If you have any further questions, feel free to post them below.
Thank you,

-John-Paul
n/a Points
2014-08-09 3:19 am

Checked it couldn't find any other htaccess file in subdirectories.

Homepage redirects fine but internal pages are still accesible via IP. Don't know whats the reason.

Is there any other alternative besides working on .htacess?

Staff
20,166 Points
2014-08-11 11:10 am
Hello Anshit,

Give this next piece of code a try. The first, to my knowledge, should have worked as well.
Options +FollowSymLinks
RewriteEngine on
#
# Redirect all requests for all non-canonical domains to same page in www.example.com
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]


Kindest Regards,
Scott M
n/a Points
2014-08-14 12:21 pm

Hi eveyone I am having some trouble becaue someone installed a wordpress site in a subdirectory under cpanel because there is a static page create for home so you can see in www.domain.com a page that says enter site and redirects to www.domain.com/wordpress and in .htaccess you can see this code:

Options +FollowSymlinks

DirectoryIndex index.htm index.php

RewriteEngine on

RewriteCond %{HTTP_HOST} !^www\.domain\.com$

RewriteRule ^(.*)$ http://www.domain\.com/$1 [R=permanent,L] 

RewriteCond %{REQUEST_URI} !^/$ 

RewriteRule ^(.*)$ http://www.domain.com/wordpress/$1 [R=301,L]

Ok, the things is that I have added an addon domain because I want to have a new site, the domain is www.domain2.info, it is added correctly but when you try to go to www.domain2.info it redirects to www.domain.com/domain2.info/

Thanks in advance for any help.

Staff
17,836 Points
2014-08-14 12:37 pm
Hello Jorge,

Sorry for the problem that you're having with the domain. This is typically the result of a domain being used as an add-on domain that has either NOT been registered with a domain registrar, or the domain is still undergoing what is called domain propagation.

If you have not registered the domain name, then you can use the Account Management Panel (AMP) to register the domain.

I hope this helps!

Regards,
Arnel C.
n/a Points
2014-08-14 12:48 pm

Actually the domain is registered and propagated because if you enter it resolves, the problem is that it redirects to the main domain of the account that is why I pasted the .htaccess code of the main domain. The domain is no registered with inmotion but the hosting account is under my inmotionhosting reseller account and the plan has enable addon domains.

Staff
17,836 Points
2014-08-14 1:12 pm
Hello Jorge,

The reason I mentioned that issue could be a non-registered domain, or a domain undergoing propagation is because we do not know you domain name and it's a common cause to the issue.

The .htaccess file applies to ALL of the folders beneath it unless you provide another .htaccess file. So, if your add-on domain is being affected by the .htaccess file in the primary domain, you need to put an .htaccess file at the root of the add-on domain. This prevents it from following the rules you set in the primary domain's .htaccess file.

Please let us know if you require any further assistance.

Regards,
Arnel C.
n/a Points
2014-08-18 4:58 pm

Hi,

My new site uses url names with php queries like

home.php?id=home

and I need to do a 301 redirect from home.php to home.php?id=home

I have tried

redirect 301 /home.php http://www.mysite.com/home.php?id=home

but this does not work

Can you help with the correct code?

Many thanks

Alan

Staff
17,836 Points
2014-08-18 5:37 pm
Hello Alan,

The problem may have to do with your web server. Try using a re-direct as per the directions above:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/home.php?id=$1 [L,R=301,NC]

If you continue to have problems with the re-direct, make sure to look at the variations above and try these options for your re-direct. Otherwise, please provide us more information on your website, such as the URL, so that we can investigate it further.

Kindest regards,
Arnel C.
n/a Points
2014-08-28 5:16 am

Hi Arnel,

Re my earlier post and your reply.

Thanks for your help.  I tried using

RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.example.com [NC] RewriteRule ^(.*)$ http://example.com/home.php?id=$1 [L,R=301,NC]

as you suggest but it still does not work! ;(

The web site url is

www.standrews-children.org.uk

and I need to redirect old site pages that no longer exist to the new ones that have replaced them

here is what I have tried using

redirect 301 /home.php http://www.standrews-children.org.uk/home.php?id=homeredirect 301 /adoption.php http://www.standrews-children.org.uk/adoption.php?id=adoption_in_scotlandredirect 301 /fostering.php http://www.standrews-children.org.uk/fostering.php?id=foster_care_in_scotlandredirect 301 /adoptionsupport.php http://www.standrews-children.org.uk/adoption_support.php?id=adoption_support_team

 

You'll get the idea of what I am trying to do.

 

Any help would be much appreciated.

 

Thanks

ALan

 

Staff
9,479 Points
2014-09-17 11:00 am
The code you provided should work without any issues. Be sure that you do not have anything else in your .htaccess file that may be interfering with the code. Renaming your existing .htaccess file to something else and placing only the redirect code in it will allow for further testing by eliminating other possible issues.

If it still doesn't work, I recommend contacting your hosting provider for more information. As this code works on our servers as well as many other hosts, your host may have something else in there that is preventing the redirect.
n/a Points
2014-08-19 6:46 am

I am currently using a permalink structure with .html extension at the end.

I now want to modify to a permalink without .html extension like

http://www.abcd.com/how-old-are-you

Can you please me with the correct redirection code?

Anand

Staff
20,166 Points
2014-08-19 8:12 am
Hello Anand,

In order to remove extensions in the address bar, you will want to take a look at our article on doing just that.

Kindest Regards,
Scott M
n/a Points
2014-08-21 12:15 pm

Hello,

I'm not a customer of inmotion, but still hoping for a little insight on the following:  If you are moving a blog that currently lives on a  blog.website.com subdomain to a new format/design located at www.website.com/blog AND (this is the interesting part) the blog. subdomain is hosted by a separate company from the one which hosts www.website.com, how does one go about implementing the redirects?

My understanding is that you have to "own" the site you're redirecting pages from, as well as the one you're redirecting pages to.  So, do you need to have ownership of the blog subdomain transfered from one host to the other? And then have that company upload the .htaccess file for all individual blog post redirects?

Thanks for any help,

Nicholas

Staff
20,166 Points
2014-08-21 1:14 pm
Hello,

You do not need to own the destination of a redirect. For example, I can redirect my domain to google.com, or even your blog if I wish. If you do not own the destination site, however, you have no control over how things work on it. That is the caveat. Your .htaccess file can redirect to another server, however any changes on the other server would need to be made on that server by someone with access to it.

I hope that helps a bit.

Kindest Regards,
Scott M
n/a Points
2014-08-22 2:02 pm

Super helpful, and thanks very much for the response!

-nicholas

 

n/a Points
2014-08-21 1:17 pm

Ok, so i messed up. I was wanting to run a redirect on my 1&1 website. and I had seen a lot of people telling me to alter the .htaccess file in order to do so. I have altered the code to send any mobile browser to an alternate page. The major problem is that the redirect page im using is on the same domain, so I keep getting reloaded on a mobile device. I need to reverse this code and I dont know how. I ran this as a script through my <head> section and when I removed it, it stayed in place because ive altered the server. 

Enough of what i think i know:

 

how do you reverse this:

RewriteEngine On

RewriteBase /

 

RewriteCond %{HTTP_USER_AGENT} (android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|mobile.+firefox|netfront|opera\ m(ob|in)i|palm(\ os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ ce|xda|xiino [NC,OR]

RewriteCond %{HTTP_USER_AGENT} ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\ wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r\ |s\ )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1\ u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(\ i|ip)|hs\-c|ht(c(\-|\ |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(\ |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(\ |\/)|klon|kpt\ |kwc\-|kyo(c|k)|le(no|xi)|lg(\ g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-|\ |o|v)|zz)|mt(50|p1|v\ )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v\ )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|\ )|webc|whit|wi(g\ |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-) [NC]

RewriteRule ^$ http://www.collinscustomjewelers.com/mobile [R,L]

Staff
20,166 Points
2014-08-21 2:16 pm
Hello Flapjack117,

If that is the code that is on that domain causing the loop, it appears it needs another rewrite condition that says if it is coming from www.collinscustomjewelers.com/mobile don't try again.

It will look something like:
RewriteCond %{REQUEST_URI} !^/mobile


You can place that right before the rewrite rule so it appears as below:
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_USER_AGENT} (android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|mobile.+firefox|netfront|opera\ m(ob|in)i|palm(\ os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ ce|xda|xiino [NC,OR]

RewriteCond %{HTTP_USER_AGENT} ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\ wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r\ |s\ )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1\ u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(\ i|ip)|hs\-c|ht(c(\-|\ |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(\ |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(\ |\/)|klon|kpt\ |kwc\-|kyo(c|k)|le(no|xi)|lg(\ g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-|\ |o|v)|zz)|mt(50|p1|v\ )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v\ )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|\ )|webc|whit|wi(g\ |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-) [NC]

RewriteCond %{REQUEST_URI} !^/mobile

RewriteRule ^$ http://www.collinscustomjewelers.com/mobile [R,L]


I tested this with my own domain and it worked successfully. Hopefully it will do so for you as well.

Kindest Regards,
Scott M
n/a Points
2014-08-25 8:32 am

Can you tell me why this, placed at the top of my .htaccess file, creates a 500-internal server error?

RewriteEngine onRewriteCond %{HTTP_HOST} ^mydayinuy.com [NC,OR]RewriteCond %{HTTP_HOST} ^www.mydayinuy.com [NC]RewriteRule ^(.*) $ http://mydayinuy.wordpress.com/$1 [L,R=301,NC

Staff
20,166 Points
2014-08-25 11:34 am
Hello Pat,

I am not quite sure why that code fails. I tested it on my own domain and it also failed. The one below was tested with my own domain and worked correctly. I have replaced my domain name with yours, so it should work for you as well.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydayinuy\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydayinuy\.com$
RewriteRule ^/?$ "http\:\/\/mydayinuy\.wordpress\.com\/" [R=301,L]


Kindest Regards,
Scott M
n/a Points
2014-08-28 10:30 am

I have a question, please anyone out there help me!!

if a user email address like "user@example.com" when form is submitted, it should go to their specific domain name i.e, www.example.com,

same should go for user like "user@gmail.com", this should be automatically go to the www.gmail.com when submit the form is submitted.

simply that have to redirect to the domain name after the @ symbol?

I want my redirect to be to the specific domain names after their @symbols

Thanks in advance

Staff
9,479 Points
2014-08-28 10:36 am
To clarify, it sounds like you want to redirect users to their email provider after they submit a contact form? If so, this can be done with custom PHP form processing through custom code on your site, but cannot be done in a simple manner.
n/a Points
2014-08-28 4:33 pm

Can you please direct me to any custom php code to achieve this project. 

I need a custom to redirect users to their email provider after they submit a contact form?

Staff
20,166 Points
2014-08-29 9:29 am
Hell Remax,

Custom code means that it does not exist and would have to be written from scratch, so there is no code for us to point you to.

Kindest Regards,
Scott M
n/a Points
2014-08-28 3:59 pm

yes, exactly that is what i want to achieve, can you please give me any php script or code to achieve this. I want to redirect  users to their email provider after they submit a contact form?  can you please refer me to a php script or code i can use to achieve this.

 

Thank you in advance

Staff
9,479 Points
2014-08-28 4:18 pm
Unfortunately, this is not something we would be able to write for you and I am unaware of any solutions that exist for this. Basically, you will need to parse the user input with PHP and redirect the user after form submission based on the data provided. If you are not a developer, the best solution would be to hire a developer to code this for you.

I would also like to add that while it is possible, it is not ideal for user experience and can cause a large number of users to become confused and thus cease activity on your site.
n/a Points
2014-08-28 4:37 pm

Thanks, i will appreciate if you can assist me. Just let give me a clue and where to find one good custom php code to make use of

Staff
20,166 Points
2014-08-29 9:30 am
Hello Remax,

Custom code means that there is not an existing script to do what you ask (that we know of.) You will either need to code it yourself or hire someone to do that as a small project.

Kindest Regards,
Scott M
n/a Points
2014-09-01 6:38 am

in my site wordpress is installed in subfolder  http://abcd.chaitanya.com/blog to  http://abcd.com/blog using htaccess with www infront of the site address

Staff
9,479 Points
2014-09-02 1:53 pm
Your comment is a bit unclear. Could you clarify?
n/a Points
2014-09-03 8:40 am

Hi Jeffma,

Sorry i forget to mention some notes in my previous comment.Actually i installed wordpress in subfolder .

My site is a subdomain.

Now what my question is how to redirect the site when the user enter the url like 

  http://abcd.chaitanya.com/blog to  http://abcd.com/blog

Because When i make advance search in google it is giving duplicate links.

How can i redirect this using htaccess

n/a Points
2014-09-03 11:55 am

Hi,

 

I am trying to re direct just the home page and not the robots.txt file

Staff
20,166 Points
2014-09-03 1:09 pm
Hello Andy,

The article itself assists in redirecting pages and does not mention robots.txt. Is there something specific you have a question about?

Kindest Regards,
Scott M
Staff
20,166 Points
2014-09-03 1:15 pm
Hello Chaitanya,

You would use the rules for redirecting from old domain to new domain.

Kindest Regards,
Scott M
n/a Points
2014-09-08 11:39 pm

Hi Bro, I want redirect my blog:

- olddomain.com to newdomain.com

- olddomain.com/oldpage1 to newdomain.com/newpage1

- olddomain.com/oldpage2 to newdomain.com/newpage2

Thank you in advance

 

Staff
20,166 Points
2014-09-09 8:00 am
Hello Lee,

The rules for redirecting the old domain to the new are above in the article.

The second requests about redirecting the old domain/page to a newdomain/page will be a combination of the old domain to new domain and the redirect from one file to another.

Kindest Regards,
Scott M
n/a Points
2014-09-10 5:37 am

Hi buddies, nice piece of info stuff. I can't find a solution for my trouble and it's not stated in your article.

I have a domain www.example.net. I would like to move all website content of that domain to a subdirectory in another domain, say www.whatever.com/example

Obviously this should be "transparent" for users, so they shouldn't realize of this change, nor should affect to web browsing or web opeations.

Can be this done via .htaccess?

Staff
20,166 Points
2014-09-10 8:04 am
Hello Ralph,

The method should mirror the redirect from old domain to new domain with one change. The new domain code portion should also include the subfolder you are using as the root for the content.

Kindest Regards,
Scott M
n/a Points
2014-09-10 10:50 am

Hi Guys,

Need some help.

Apparently there are some old links to us out on the internet for some of our old domains.

 

The new domain is www.bvtlive.com

 

None of the below exists at all. and is redirected to bvtlive.com

http://www.brandywinevalleytalent.com

http://www.bvtbands.com

 

I have tried redirection www.brandywinevalleytalent.com to www.bvtlive.com which does work using the following.

 

## redirect brandywinevalleytalent.com

RewriteCond %{HTTP_HOST} ^brandywinevalleytalent.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www.brandywinevalleytalent.com [NC]

RewriteRule ^(.*)$ http://www.bvtlive.com/$1 [L,R=301,NC]

## redirect bvtbands.com

RewriteCond %{HTTP_HOST} ^bvtbands.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www.bvtbands.com [NC]

RewriteRule ^(.*)$ http://www.bvtlive.com/$1 [L,R=301,NC]

 

BUT when the url is as below with additionalinfo on the end it redirects...

 

FROM: http://www.brandywinevalleytalent.com/jellyroll/blog.asp

TO:  http://www.bvtlive.com/jellyroll/blog.asp

 

This dosen't really help because the asp no longer exists since this is a joomla site. 

I would love if i could get it to go...

 

FROM: http://www.brandywinevalleytalent.com/jellyroll/blog.asp

TO:  http://www.bvtlive.com/

 

Any help in the htaccess rhelm would be appreciated.

John H

Staff
17,836 Points
2014-09-10 12:48 pm
Hello John,

Sorry for the re-directs. I checked both of those domains and they still do exist on the internet. You would need to contact the domain registrars managing those domains and then either shut them down or change the DNS to point to our hosting service. Your re-directs for those domains will not work unless the DNS is being read from our servers. Otherwise, you would have to create those redirects where ever those domains are being hosted.

I hope this helps to clarify the matter. If you still require assistance, please let us know.

Regards,
Arnel C.

n/a Points
2014-09-12 11:05 am

Hi friend

i would like to redirect www.example.net to www.example.com

i have done this through 301 redirect

but unfortunately robots.txt also redirect to www.example.com/robots.text and shows 404 error

i dont want to redirect www.example.net/robots.txt to redirect to .com however all other page i need to redirect to .com

i need to keep robots.txt on .net so that google bot completely deindex all pages

 

i need solution to handle this sitution

thanks in advance

 

 

 

 

 

Staff
20,166 Points
2014-09-12 12:02 pm
Hello Sohel,

You may want to add an exception to your rules just under the http host condition, right before the rule. Below is a condition that says to ignore the redirect for /robots.txt.
RewriteCond %{REQUEST_URI} !^/robots\.txt$


Also, by 301 redirecting the .net to the .com, Google will drop the index of the .net anyway. Also, you can dictate this behavior specifically in Google's webmaster tools.

Kindest Regards,
Scott M
n/a Points
2014-09-12 3:07 pm

Hello scott

thanks a lot for direction

by reading all post i expect answer from you and u have did it

 

i was puzzled whole day to solve this

Now second issue is that we have two website

(1) www.example.com in this web site when we open any url of web site with  HTTPS then browser ask for security and then open the same html page of  HTTP. so my issue is google consider such variation as domain variation and if yes is google penalised for in this case for duplicate content and if yes then how to resolve such situation through .htaccess redirect (301)  hosting Net firm

(2) www.example.net on this web site when we open any url with https then it return to home page of hosting provider (cPanel Home Page) altough we have removed the home page of hoster from server

 

 

 

so my question                                                                                                   why such difference on two website

is https and http difference in domain effect SEO

it is necessary to Redirect HTTPs to http through 301 and if yes please mention code

lastly why such difference arise

 

i came to know about this issue from siteliner.com seo toolsagain thanks in advance

 

Staff
10,317 Points
2014-09-12 4:49 pm
Hello SOHEL,

Thank you for your question. It is difficult to say what will help your SEO, since only Google knows the algorithm, and they make changes to it regularly.

I don't think google will see an https site being accessed via http as duplicate content. But a recent post in Google's Official Webmaster tools blog states "we're starting to use HTTPS as a ranking signal. For now it's only a very lightweight signal — affecting fewer than 1% of global queries, and carrying less weight than other signals such as high-quality content — while we give webmasters time to switch to HTTPS. But over time, we may decide to strengthen it, because we’d like to encourage all website owners to switch from HTTP to HTTPS to keep everyone safe on the web."

If your site is redirecting to another URL, you may have to update the URL in the software. For example in WordPress, Joomla, etc. have to update the URL in the software settings.

If you have any further questions, feel free to post them below.

Thank you,
John-Paul
2014-09-17 8:37 am
Dear friends,

we bought an expired domain that apparently has a lot of backlinks to main domain but also in several different subdomains of the main domain name. As we rebuild from scratch and on a different style,links etc this domain, we want to be able with a central rewrite command to keep all the link juice on Google from any other subdomains or indexed pages of the old domain driving to the new domain automatically.

Is this command the correct to use or we have to use something different?
RewriteEngine on
redirectMatch 301 ^(.*)$ http://www.domain.com$1
redirectMatch permanent ^(.*)$ http://www.domain.com$1

Any help would be really appreciated.
Staff
9,479 Points
2014-09-17 11:28 am
Your code is somewhat correct. It appears that you are checking for a pattern to redirect, but not actually defining where to redirect to. I recommend looking at the code examples that are within this article for more complete code.
2014-09-17 2:16 pm
Jeff thanks.
I try to redirect all the previous subdomains indexed on Google to my homepage of the newly rebuilt site.
In other words to simplify, everything that is already indexed on these subdomains, has a huge linkjuice from before on the subdomains. I try to show Google, that the new relevant content from all these subdomains.domain.com previously indexed(existed on Google) for this major domain.com which we bought, can be now redirected at www.domain.com.
I hope there should be a redirect code that with a bit regex can redirect not?
Staff
9,479 Points
2014-09-17 2:50 pm
If you're trying to redirect various subdomains to other locations, chances are you won't be able to do it automatically to particular locations. You can, however, set a particular subdomain to redirect to the main domain. To do so, you would need to create each of those subdomains, and place redirects from those subdomains to your target location.
2014-09-17 5:30 pm
So in fact I create the subdomains, I 301 them via cpanel to the main site and all the rest indexed I find I use the:
RewriteEngine on
redirectMatch 301 ^(.*)$ http://www.domain.com$1
redirectMatch permanent ^(.*)$ http://www.domain.com$1

Is this correct, or I am missing something. Jeff in fact I try to redirect any indexed url to my main new site. These indexed links are a lot and I try to find a general rule that I redirect everything to the main site so that I don't lose the juice as the old site (old owner) was very relevant to what we build.
Staff
9,479 Points
2014-09-17 5:42 pm
If you place those lines within the .htaccess file of the root directory for each of the subdomains, they will redirect to the appropriate location that you have defined. If you're not seeing the change, try clearing your browser cache as you may have some cached data there.
n/a Points
2014-09-17 5:31 pm

Greetings. I am hoping I can get some advice on how to most efficiently accomplish the following, any help would be appreciated: 

1. We are rebuilding a new site, in Drupal, on a test domain. 

2. We will transfer it to the URL that the current site is located at upon completion. 

3. During the process the URL structure will change. 

4. We would like to find the easiest way to redirect or eliminate the possibility of having tons of 404s on our site. The site has 1,000s of pages so changing URL structures by hand is not possible. 

Thanks in advance. 

Staff
9,479 Points
2014-09-17 5:39 pm
Movie a Druapl site back and forth between testing and production environments is quite simple. The following article will help you in doing so:

Setting up a Druapl test site
n/a Points
2014-09-19 10:03 am

Thanks, Jeff. 

We have already created the site on a seperate domain, not a sub-domain. 

The concern is that when we move the site from the test domain (where the site is being built) to the current domain, where the old site is currently located, that we will end up with tons of 404s due to the URLs of the original site no longer being used. 

1. Do you think this is an issue in terms of SEO? 

2. Is there an easy or bulk way to recreate the URLs of the test site so they match the URLs of the current site? 

3. If no to number 3, would it be best to redirect? 

Thx in advance

Staff
20,166 Points
2014-09-19 10:34 am
Hello Jason,

If you do not have the same structure in the new site, you may have some work ahead of you. You may not need to create a redirect for each of the old pages to go to the new pages, but you may need to create redirects from other categories, subfolders, etc to point to the new ones.

For example: oldsite.com/old-category/page1 to newsite.com/new-category/page1
For that you would need to set up a 301 for the domain to redirect anything from oldsite.com/old-category to newsite.com/new-category. If you had 100 pages under that old-category, then you have successfully set the redirect for 100 pages. If you have thousands of pages, this may still mean quite a few lines of code to get all the site redirected properly.

Kindest Regards,
Scott M
n/a Points
2014-09-17 11:22 pm

I have about 150+ websites and I want to create one .htaccess file for all. in your code i have to add example.com (website name) in it. 

Is there any code I can use whatever domain it is, it should redirect from www to non www ?

Staff
20,166 Points
2014-09-18 10:40 am
Hello Abid,

The code you are looking for is as follows:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
</IfModule>

We have tested it on our servers with multiple domains and it works fine. Note that it only works for all domains on a single cPanel, so you will need to place it at the highers folder point in each cPanel so it works for all domains.

Kindest Regards,
Scott M
n/a Points
2014-09-18 4:16 am

Plz help me to redirect my website from http://empirepropertiesdubai.com/ to http://www.empirepropertiesdubai.com/

Staff
20,166 Points
2014-09-18 8:40 am
Hello Manoj,

The instructions for what you are asking are above under the "Forcing the www version of domain to be used" section. Follow that and your site will always redirect to the www version.

Kindest Regards,
Scott M
n/a Points
2014-09-20 1:25 am
Thanks for putting this info up...had looked at several other sites info and nothing was working. Your example was spot on and problem was solved.
n/a Points
2014-09-20 7:48 pm

Hello,

I have gone through your tutorial. It has given me enough information to redirect the url. Based on your tutorial i have written for my code. But its not working

 

RewriteEngine On

RewriteRule ^([a-zA-Z0-9_-]+)$ FresherOffcampuApply.php?var=$1 [R=301, L]

RewriteRule ^([a-zA-Z0-9_-]+)/$ FresherOffcampuApply.php?var=$1 [R=301, L]

Please help me as this is hampering my work as lot.

Thanks,

Padmaraju.

 

Staff
20,166 Points
2014-09-22 8:52 am
Hello Padmaraju,

What is it you are trying to do exactly?

Kindest Regards,
Scott M
n/a Points
2014-09-22 7:10 pm

My problem is that i have a url like this-

/FresherOffcampuApply.php?var=Cognizant-walkin-interview-for-freshers-Sep-9

I want to show like this in the url 

/Cognizant-walkin-interview-for-freshers-Sep-9

For this i have written the .htaccess code as 

RewriteEngine On

RewriteRule ^([a-zA-Z0-9_-]+)$ FresherOffcampuApply.php?var=$1 [R=301, L]

RewriteRule ^([a-zA-Z0-9_-]+)/$ FresherOffcampuApply.php?var=$1 [R=301, L]

But this doesn't work. Please help me on this.

Thanks,

Padmaraju

Staff
9,479 Points
2014-09-22 7:20 pm
The following rewrite rule should work in redirecting as you would like it to:

RewriteEngine On
RewriteRule ^([^/]*)$ /FresherOffcampuApply.php?var=$1 [L]

n/a Points
2014-09-23 11:03 am

I have tried in the same way but am getting the below error-

[error] [client 127.0.0.1] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.

n/a Points
2014-09-22 4:45 am
I think this is a brilliant article, which clearly demonstrates the results of the given code.

No improvements should be made, as it is clear, concise and relevant.

Thanks
n/a Points
2014-09-22 2:06 pm

here my site at present in demo2.com/demo and i want to redirect this domain into demo.net/demo and i have changes in .htacces like this 

 

RewriteEngine on

RewriteCond %{HTTP_HOST} !^demo2.com/demo

RewriteRule ^(.*)$ demo2.com/demo [R=permanent,L] 

RewriteCond %{REQUEST_URI} !^/$ 

RewriteRule ^(.*)$ demo.net/demo [R=301,L]

 

 

and refresh my browser then it's says "This webpage has a redirect loop"

 

any solution on this.

Staff
17,836 Points
2014-09-22 4:06 pm
Hello Abhishek,

Thanks for providing some detail on the problem you're having. It has to do with how you wrote the rewrite rules. Here's how it should work. The comments below explain each line:

RewriteEngine On
#checking for the domain
RewriteCond %{HTTP_HOST} ^demo2\.com$ [NC]

#checking to make sure that the URL is "/demo"
RewriteCond %{REQUEST_URI} ^/demo$ [NC]

#with those two conditions met, the rewrite rule can now re-direct correctly
RewriteRule ^(.*)$ http://demo.net/demo [R=permanent,NC,L]


I hope that helps to explain the issue! Please let us know if you have any further questions.

Kindest regards,
Arnel C.
n/a Points
2014-09-29 6:20 am
Very nice article.....
n/a Points
2014-09-30 9:35 am

I have a website built on Joomla, Now I want to convert it to .php version, How to redirect the old URL to New URL.

For Example

www.mydoamin.com/aboutus to www.mydoamin.com/aboutus.php

How achive this?

Total I have got 40 to 50 URL's. Do I need to create each and every folder like aboutus folder, in that index.php, in that 301 rdirection code to the new URL(aboutus.php) or How to achive this.

Plz. help me and do the needful.

 

Thankyou in advance.

Staff
17,836 Points
2014-09-30 1:15 pm
Hello Naveen,

Thanks for your question. However, it doesn't make too much sense as a website built in Joomla is already using PHP. So, when you say "convert to a PHP version" we're not quite clear about what you are trying to do. You can use a the rewrite options as instructed above to re-direct people to your new URLs. We're not sure what you're trying to do in the re-creation of the site in PHP. If you are building a new website, then the URLs should be different and the re-direct are only being used to preserve search engine rankings from the older site.

If you have any further questions, please let us know. If you have any further specific questions, please let us know.

Regards,
Arnlel'h
n/a Points
2014-09-30 4:51 pm

Hi,

 

I'm trying to redirect some old pages on my WordPress site. I am redirecting:

Redirect 301 /work /our-work/

Redirect 301 /work/ /our-work/

Redirect 301 /work/project1 /our-work/

I have renamed the folder and also expired a project page that I want to redirect to the parent folder. The folder redirect works, but the expired URL redirects to /our-work/project1, which is not what I want as the page no longer exists. I am new to redirecting - what am I doing wrong?

Thanks in advance.

Staff
17,836 Points
2014-09-30 5:18 pm
Hello Lee,

Sorry to hear about your redirect problem. You did not give us enough detail on the problem. Can you provide the actual URL, and the code used to make the redirects? The information you're providing is not complete enough to assess the issue. Provide us a little more information and we would be happy to help!

Regards,
Arnel C.
n/a Points
2014-10-01 3:45 am

Yes, sorry more details would have helped. The domain is http://designbycream.com. The HTAccess file has the standard wordpress rule applied and I am trying to redirect some child pages back to the parent folder as they have expired. I am also trying to redirect the old folder name to the new one and I think this is where I am having the issues.

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

 

Redirect 301 /work http://designbycream.com/our-work/

Redirect 301 /work/ http://designbycream.com/our-work/

Redirect 301 /work/long-mynd http://designbycream.com/our-work/

Thanks,

 

Lee

Staff
9,479 Points
2014-10-01 9:42 am
This may be causing issues because the WordPress rewrites are being called before the redirects which can handle the files a bit differently. Instead, try placing the redirects before the rewrites provided by WordPress.
n/a Points
2014-10-01 5:44 am

Hi, thanks for your early reply,

 

Sorry, if I had not provided sufficient info.  Here is the brief description about my issue.

Right now we have http://www.example.com/aboutus in joomla platform. For the same page the URL is going to change in new website. The new URL would be http://www.example.com/aboutus.php.

other example would be http://www.example.com/ongoing-projects/aboutus is a joomla page, now the new php page would be like http://www.example.com/ongoing-projects/aboutus.php . Which is the appropreate method to do the SEO friendly 301 redirection method. I have got 100+ URL's to redirect.

 

Staff
9,479 Points
2014-10-02 3:19 pm
If All of the files have the exact same parrtn and simply need to add .php to the end of them, the following .htaccess rule may be used:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\..+$
RewriteRule ^(.*)$ /$1.php [R=301,L]

n/a Points
2014-10-03 4:56 am

Solved the issue thank you. Best advice found on web (google) how to use 301 on apache server.

Tried several versions on www.africasiaeuro.com - africasiaeuro.com , only yours worked.

Great job, well explained

thanks

n/a Points
2014-10-04 1:30 pm

I once set up a 301 redirect to direct mastechpowersupply.com to www.mastechpowersupply.com, and deleted the redirect in the htaccess file afterwards. however, the redirect seems still in place. is this normal and how can I get rid of the redirect?

 

Sean

Staff
20,166 Points
2014-10-06 10:41 am
Hello Sean,

I visited your site using the non-www version and was not redirected. It seems to now be working correctly. If you are still having that experience, you may want to test another browser or clear the cache of the affected browsers. Once the command is removed, it should no longer redirect.

Kindest Regards,
Scott M
n/a Points
2014-10-04 3:47 pm

My WAMP Keeps redirecting to live site url, e.g. when I type localhost/my-site, the browser redirects to http://my-site instead od http://localhost/my-site....please what can I do to repair this.

 

Thank you

Staff
20,166 Points
2014-10-06 11:47 am
Hello Damilola,

It can depend on what your site is doing. It may have code that redirects based on configuration information in either files or the database. Check your .htaccess file to ensure the proper code is there and no other code is present that can interfere.

Kindest Regards,
Scott M
Staff
17,836 Points
2014-10-06 11:53 am
Hello Damilola,

Sorry to hear you're having problems with WAMP. Since WAMP is a product that runs on a local computer (not on a server), we do not generally support it. Based on what you are saying though, it appears that you either need to modify your HOSTS file or review your installation instructions for WAMP.

Regards,
Arnel C.
n/a Points
2014-10-07 5:46 am

Hello Scott, you legend. Any change of a quick bit of help for me? I have a url:

mydomain.com/tag/website-design-limerick/

that i want to redirect to

mydomain.com/tag/web-design-limerick/

...any chance you could tell me what to put into my .htaccess file!?

 

-Jon

Staff
9,479 Points
2014-10-07 8:03 am
The specific lines you would place in your .htaccess file would be:

Redirect 301 /tag/website-design-limerick/ /tag/web-design-limerick/

n/a Points
2014-10-07 11:03 am

That's fantastic thanks. And it worked a charm. Brilliant!

n/a Points
2014-10-07 1:35 pm
No need to improve. It was concise, clear and helpful.
n/a Points
2014-10-09 7:47 pm

Please what can i do i have redirected my Domain A (old domain.info) to my Domain B ( new domain.com) but all search engine linking to my Domain A is not directing to the link on Domain B its bringign 404 errors! what can i do do get out of this.?

Staff
17,836 Points
2014-10-09 8:22 pm
Hello Ogunfeitimi,

Sorry to hear that you're having problems with the search results. The problem that you're having should be able to be resolved with a wildcard re-direct. This means that ANY path that used the old domain should be re-directing with the new domain. This can be done in cPanel with the Redirect option, or you can make the changes directly in .htaccess. The 301 re-direct information in the article on this page gives you the information for making these changes. Your re-direct should not be limited to a single page if you have multiple website pages that are affected by the domain name change.

I hope this helps to provide the information you need to correct the issue. Let us know if you have any further questions.

Regards,
Arnel C.
n/a Points
2014-10-10 4:15 am

Hello thanks for the response, please how can i direct my redirect to so many pages as you discussed ? its a blog so i have so many search engine indexxes of my post!

Staff
20,166 Points
2014-10-10 9:31 am
Hello Ogunfeitimi,

You should be able to get the desired behavior by following the instructions in the Redirect an old domain to a new domain section above. If not, please give a sample of the code you are using so we can see what may be wrong.

Kindest Regards,
Scott M
n/a Points
2014-10-14 5:24 am

i am facing problem to redirection of the all post url to new one url with category name will come  before post name. i will get all post name and category name .

just want to how to place it into htaccess file for redirection

want to write script into htaccess for redirection on click  of button in plugin

Staff
20,166 Points
2014-10-14 8:03 am
Hello Vivek,

If you are working with a CMS, for example WordPress, it is best work within the dashboard to set up the PermaLinks or Search Engine Friendlys (SEF) URLs. Working within the .htaccess file overwriting what the CMS is expecting can break your site altogether.

Kindest Regards,
Scott M
n/a Points
2014-10-14 7:01 pm

Last time the site is running in non-https so all links are already cache and index for that version and we recently purchase a ssl cert to secure https version of the site. Is it recommended that all pages should be in https or only those login and register page or my account page in OpenCart.

How about redirecting from http to https version it seems that the old links are still in http version for example.

https://www.domain.com/about-us

it will open in the url ask https://www.domain.com/index.php?_route_=about-us

is it okay to leave this or does it need config to work this on the expected url which is

https://www.domain.com/about-us

 

Staff
9,479 Points
2014-10-14 7:05 pm
It is perfectly fine to use HTTPS on all pages and actually now recommended by Google. As far as the redirects, once OpenCart is configured for HTTPS, it should redirect automatically.
n/a Points
2014-10-18 12:18 pm

I am using this RedirectMatch 301 (.*)\.html$ http://www.mydomain.com$1/ to redirect all of my pages from .html to just a directory.

Example

mydomain.com/directory/page.html

to

mydomain.com/directory/page

It seems to be working except all the links to the homepage of my site are being redirected to /index and I have receiving a 404 error.

I am using Joomla with sh404sef.

Any help is appreciated.

Staff
17,836 Points
2014-10-20 12:02 pm
Hello Chris,

Sorry to hear that you're having problems with the re-direct. Unfortunately, you have not given us enough information in order to determine why the direct is not working. I know that we can make re-directs directly in Joomla. Make sure that you have now re-directs in Joomla directly affecting your site.

If that is not the case, please provide us your domain URL. If you are a customer we would be able to look at the re-direct code in the .htaccess and see how it's affecting your site. If you are not a customer, then still do provide the site URL, and copy of your .htaccess file to review the issue.

Regards,
Arnel C.

n/a Points
2014-10-21 10:54 am

I can get the redirect to work properly except for my homepage. When I add the redirect in, my domain www.classic-tv.com forwards to www.classic-tv.com/index.

Other than that it works perfectly!

I am not a customer.

 

# BLOCK BAD BOTS AND USER AGENTSErrorDocument 403 "Forbidden"ErrorDocument 416 "Requested Range Not Satisfiable"RewriteEngine OnRewriteCond %{HTTP_USER_AGENT} Mozilla\/5\.0\ \(\) [OR]RewriteCond %{HTTP_USER_AGENT} ^Mozilla\/4\.0$ [OR]RewriteCond %{HTTP_USER_AGENT} Mozilla\/4\.0\ \(compatible;\) [OR]RewriteCond %{HTTP_USER_AGENT} ^-?$ [OR]RewriteCond %{HTTP_USER_AGENT} ^Mozilla$ [OR]RewriteCond %{HTTP_USER_AGENT} \.NET\ CLR [OR]RewriteCond %{HTTP_USER_AGENT} pid$ [OR]RewriteCond %{HTTP_USER_AGENT} Tweetmemebot/|TweetedTimes|TwitterFeed|Twitterbot/|Flipboard|SocialBot|Digg|TwitterCrawler [NC,OR]RewriteCond %{HTTP_USER_AGENT} PHP/|Java|Incutio|Moreover|MetaURI|kraken/|Slurp|Livelapbot/|ShowyouBot|EasouSpider|ADmantX|WBSearchBot|LinkpadBot|Blekkobot|Wotbox|ZumBot|Blekkobot|CCBot|360spider|meanpath [NC,OR]RewriteCond %{HTTP_USER_AGENT} proximic|Photon/|Jakarta|HttpClient|python|ruby|jack|NING|curl|DotBot|bitlybot|crawler4j|Marfeel-crawler|WinHttpRequest|HubSpot|DBot|ASProxy|XoviBot|SpiderLing|URLAppendBot [NC,OR]RewriteCond %{HTTP_USER_AGENT} CCBot|AlexaBot|Owlin|Spinn3r|Genieo|Riddler|SeznamBot|360SE|LBBROWSER|Infegy/|Sogou|bixocrawler|uMBot|Grapeshot|NextGenSearchBot|GroupHigh|aria2|HttpTool|whisper [NC,OR]RewriteCond %{HTTP_USER_AGENT} RSSList|Synapse|gsa-crawler|CrawlerProcess|InAGist|CRAZYWEBCRAWLER|FatBot|ShopWiki|coccoc|Bork|YaBrowser|AddThis|Arachnophilia|woobot|Wayback|trendictionbot|ELNSB50 [NC,OR]RewriteCond %{HTTP_USER_AGENT} junglee|RediffNewsBot|Alertmix|Exabot|FunWebProducts|PaperLiBot|linkdexbot|Twurly|Embedly|feedjira|Kimengi|Junkie|newspaper|Percolate|newsme|feedzirra|a6corp|Twingly|LongURL [NC,OR]RewriteCond %{HTTP_USER_AGENT} as_qdr|netEstate|tools\.ua\.random|archive\.org|Edition\ Campaign|Anturis|rogerbot|MojeekBot|meanpathbot|JS-Kit|Dispatch|grokkit|OpenHoseBot|Twikle|Icarus6j [NC,OR]RewriteCond %{HTTP_USER_AGENT} Sztaki-kereso|Sysomos|spbot|magpie|maxpoint|PagesInventory|Abonti|TNX|YahooCacheSystem|knelson|voltron|acapbot [NC]RewriteRule .* - [R=416]

# BLOCK ABUSIVE USER AGENTSRewriteEngine onRewriteCond %{HTTP_USER_AGENT} Mozilla\/4\.0\ \(compatible;\ MSIE\ 6\.0;\ Windows\ NT\ 5\.1\) [NC,OR]RewriteCond %{HTTP_USER_AGENT} Mozilla\/4\.0\ \(compatible;\ MSIE\ 6\.0;\ Windows\ NT\ 5\.1\ SV1\) [NC,OR]RewriteCond %{HTTP_USER_AGENT} Mozilla\/4\.0\ \(compatible;\ MSIE\ 6\.0;\ Windows\ NT\ 5\.1;\ SV1 [NC,OR]RewriteCond %{HTTP_USER_AGENT} Mozilla\/4\.0\ \(compatible;\ MSIE\ 5\.0;\ Windows\ 95\) [NC]RewriteRule .* - [R=416]

RewriteEngine OnRewriteCond %{REQUEST_URI} ^/joomla3/ [OR]RewriteCond %{REQUEST_URI} ^/images/RewriteCond %{REQUEST_URI} \.(png|jpg|jpeg|ico|bmp|gif)$ [NC]RewriteRule .* - [L]

# KNOWN FORUM SPAM SOURCE IP BLOCKSdeny from 27.deny from 37.221.deny from 50.19.deny from 50.28.deny from 54.deny from 62.210.deny from 65.deny from 64.95.deny from 77.95.deny from 77.109deny from 77.247.deny from 85.17.deny from 94.23.deny from 107.22.deny from 120.43.deny from 140.237.deny from 149.210.135.deny from 155.94.deny from 183.252.deny from 188.138.deny from 188.165.deny from 192.3.deny from 192.95.deny from 192.99.deny from 192.161.deny from 192.171.deny from 192.199.deny from 192.227.deny from 192.240.deny from 192.255.deny from 193.201.deny from 195.2.deny from 195.211.deny from 198.deny from 202.46.deny from 204.12.deny from 208.66.deny from 216.107.156.

AddType audio/mpeg mp3AddType audio/mp4 m4aAddType audio/ogg ogaAddType audio/webm webmaAddType audio/wav wavAddType video/mp4 mp4AddType video/mp4 m4vAddType video/ogg ogvAddType video/webm webm

#preserve bandwidth for PHP enabled servers <ifmodule mod_php4.c>  php_value zlib.output_compression 16386 </ifmodule>

#If available, set the expires to 'far future'<IfModule mod_expires.c> ExpiresActive on ExpiresDefault "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType application/x-javascript "access plus 1 week" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/ico "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/x-icon "access plus 1 month" ExpiresByType text/css "access plus 1 month" ExpiresByType video/x-flv "access plus 1 month"</IfModule>

#Turn off ETagsFileETag none

##  Can be commented out if causes errors, see notes above.Options +FollowSymLinks

##  mod_rewrite in use

########## End - Rewrite rules to block out some common exploits

#  Uncomment following line if your webserver's URL#  is not directly related to physical file paths.#  Update Your Joomla! Directory (just / for root)

# RewriteBase /

########## Begin - Joomla! core SEF Section#RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_URI} !^/index.phpRewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]RewriteRule (.*) index.phpRewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

########### End - Joomla! core SEF Section

RewriteEngine On

#  Uncomment following line if your webserver's URL#  is not directly related to physical file paths.#  Update Your Joomla! Directory (just / for root)

RewriteBase /

########## Begin - Rewrite rules to block out some common exploits## If you experience problems on your site block out the operations listed below## This attempts to block the most common type of exploit `attempts` to Joomla!## Block out any script trying to set a mosConfig value through the URLRewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]# Block out any script trying to base64_encode crap to send via URLRewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]# Block out any script that includes a <script> tag in URLRewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]# Block out any script trying to set a PHP GLOBALS variable via URLRewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]# Block out any script trying to modify a _REQUEST variable via URLRewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})# Send all blocked request to homepage with 403 Forbidden error!RewriteRule ^(.*)$ index.php [F,L]########### End - Rewrite rules to block out some common exploits

Staff
9,479 Points
2014-10-21 11:10 am
This is because Joomla uses rewrites for their search engine friendly URLs. To remove the .html suffix from your URLs, you may go to your search engine friendly URLs section and turn Add Suffix to URLs to off.

If you prefer to do it directly within your .htaccess file instead of doing so within your Joomla admin, you can add the following to the bottom of your .htaccess file instead:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

n/a Points
2014-10-21 3:52 pm

Yes, but I want to truely redirect my old .html page to one with out the .html.

For years my site's pages ended in .html and I've since decided to change that. Now all of my links in Google, etc do not forward to the new page without the .html

The redirect you gave works fine except my hompage redirects to /index instead of just staying on the .com.

Staff
9,479 Points
2014-10-21 4:07 pm
I went to your site to try to replicate the issue and currently I was unable to see a problem. I also attempted to add .html to the end of the URLs in which I do see they are redirecting correctly.
n/a Points
2014-10-21 4:16 pm

That's because I do not have the redirect added right now because it redirects my homepage to /index.

Look at this page http://www.classic-tv.com/ratings/1950-1951-tv-show-ratings.html

you'll get a 404.

The URL is really http://www.classic-tv.com/ratings/1950-1951-tv-show-ratings

Some pages I've manually added through my Joomla SEF program to forward correctly.

Staff
9,479 Points
2014-10-21 4:18 pm
Unfortunately, due to the way Joomla works, there isn't a way to avoid the issue with it redirecting to /index on the home page with an overall redirect. Your best solution would be to create each of the redirects individually for the pages that you are getting 404 errors on.
n/a Points
2014-10-21 8:51 pm

Hi, I just launched a WordPress redesign of an .htm website that started as www.example.com and is now example.com. The site owner changed the names of some pages, some urls were misspelled and I fixed them, and there were a few other changes to the site structure, along with many pages that didn't change except for the .htm becoming a trailing slash. I started with individual redirects like this:

Redirect 301 http:/www.example.com/page.htm http://example.com/corrected-page/

But it didn't work, so I tried this:

Redirect 301 .page.htm http://example.com/corrected-page/

Still didn't work, and my client is on the way to a conventino, so for expediency's sake, I did this:

Redirect 301 http://www.example.com http://example.com

This of course redirects the home page, getting people where they need to go for the newly presented site, but direct requests and the old site links in search results still land on the old pages. Since this site has been online since 1985 and most pages are ranking around a 4 and appear in serp well for keywords, we do want to transfer the link juice to the new site, but I'm a bit stumped as to why my first redirect attempts didn't work. can you dial me in on how to resolve this?

Staff
9,479 Points
2014-10-21 10:19 pm
As you are using WordPress, there is a WordPress plugin called Redirection which will allow you to easily add redirects as well as other things like monitor your 404 pages.
n/a Points
2014-10-22 11:30 am

LOL! I guess patience was the best solution on this one. I had just installed the Redirection plugin and had entered one redirect when I got detoured back over to Google, did a fresh search for my client's site, clicked one of the subpages and it took me straight to the new version! Started clicking on others with the same wonderful results! I guess since his site has been online for 21 years, the search engine just took a little longer to "believe" it was being redirected than they ordinarily do. My past experience with redirects in htaccess is that they pretty much take effect immediately and this is the first time I've had it take nearly 24 hours to kick in. Always good to know that some things do take time. Thanks so much for your suggestion, though, I'll keep that in mind for future projects.

n/a Points
2014-10-22 4:29 pm

Hey guys, hoping you could help with an http to https redirect question.

I'm trying to force https for all pages on an ecommerce site.  Forcing this is not the issue, but I would like to do so and have the redirects be 301's instead of 302's.  Also on of the biggest issues is the main domain https://www.website.com/ is redirecting to itself via a 302.

This prevents me from using any crawler type tools such as Screaming Frog, Xenu, etc. for any site diagnosis.

Here is the original code: we have played with it a bit but figured I would just give the original.

RewriteEngine On

 

# masks .php extension

RewriteBase /

RewriteCond %{SCRIPT_FILENAME} !-d

RewriteRule ^([^\.]+)$ $1.php [NC,L]

 

# denies trace/tracks

RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)

RewriteRule .* - [F]

 

# Forces SE into HTTPS

RewriteCond %{SERVER_PORT} 80 

RewriteRule ^(.*)$ https://www.website.com/$1 [R,L]

 

# no directory listings on directories without an index

Options -Indexes

 

# deny access to sys config files

<Files ~ "\.htpasswd$|\.inc$">

order allow,deny

deny from all

 

</Files>

 

I tried adding the R=301 but that didn't fix the main url issue.

 

Thanks in advance!

 

Jason

Staff
17,836 Points
2014-10-22 5:51 pm
Hello Jason,

Sorry for the problem. You said that adding the 301 designation did not fix the problem, but you didn't say if it was causing an error. And literally, you're not pointing to a different domain, so the re-direction definition is correct. That's not something you can change for the sake of the site diagnosis tool. You would need to change it to a different domain for the 301 to be appropriate. Everything else looks correct, so we're unsure if there's anything we can change in the re-direct code at this point.

Regards,
Arnel C.
n/a Points
2014-10-22 5:57 pm

Thanks for the replay Arn,

I didn't get an error although, the main domain was still showing a 302 and redirecting upon itself in an endless loop it seemed.  I tried replacing the redirect portion of code above:

# Forces SE into HTTPS

RewriteCond %{SERVER_PORT} 80 

RewriteRule ^(.*)$ https://www.website.com/$1 [R,L]

With this:

# Forces SE into HTTPS

RewriteCond %{SERVER_PORT} 80

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} !^www\.

 

RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

And that is how it is currently.  I didn't know if we could disallow so to speak the https://www.website.com/ from redirecting to itself or not - or if that would fix anything.  The above version forces 301's other than for the https://www.website.com/ which remains a 302 upon itself.

Appreciate your time :)

Staff
17,836 Points
2014-10-22 6:20 pm
Hello Jason,

No problem, and sorry I'm not able to give you a good work-around for this issue. Everyone I've asked about this has said that since the domain is redirecting to itself - regardless of the https - the redirect is classified (correctly) as a 302. If you were re-directing a different domain, then it could be considered a 301 - a permanent change to a different location.

I also dug up an interesting forum post on the issue that you can find http to https re-direct. One of the posts suggest using Apache Virtual Hosts to solve the issue might be a possible work-around for you if you have access.

Regards,
Arnel C.
n/a Points
2014-10-22 9:46 pm

I've built a new site.

Some of the old site's pages have corresponding pages in the new site. Some do not.

Unless someone tells me it's a bad idea, I was planning to redirect the old pages to the new pages where they exist, and redirect the remaining old pages to the main page of my new site.

Is there a way to do that? Or are the choices:

A) redirect the whole site to a new site

and

B) redirect each page, individually.

Thanks!

Staff
10,317 Points
2014-10-23 4:31 pm
Hello Rlchard,

Thank you for your question. First redirect the old domain to the new domain as described above. Then create a 404 redirect that will redirect the missing pages to the new domain, like this:
ErrorDocument 404 http://newdomain.com

If you have any further questions, feel free to post them below.

Thank you,
John-Paul
n/a Points
2014-10-23 3:00 pm

Hi, 

I have a site, where we moved the urls like this

example.com/movies/12345 ( movieid)

to

example.com/movies/12345/title-of-the-movie

can you help me out with the rewrite condition please?

thanks!

Staff
10,317 Points
2014-10-23 5:27 pm
Hello Juan,

Thank you for our question. Unfortunately, I don't know an easy way to accomplish this using an .htaccess rule, unless you redirect each page individually. This is because the page names are changing from the movieid to the title-of-the-movie.

I recommend looking for a plugin, or addon for your CMS that can simplify the redirect.

Alternately, a developer should be able to custom code something in PHP, or the Database to accomplish this.

If you have any further questions, feel free to post them below.

Thank you,
John-Paul
n/a Points
2014-10-23 6:00 pm

Recently redesigned our site for http://www.logicweb.com

All previous files were .php extensions and so Google webmaster tools naturally is giving off about 150 errors because the .php old files cannot be found. This is odd because the updated sitemap with the current .html files was updated immediately upon launch, with no errors there. Why Google is still looking for the old .php files I cannot figure out.

My question is, using htaccess how can I 301 all old. php files in one instance BUT with a couple of sub-directory as exceptions to this rule? In other words, redirect all .php except logicweb.com/billing.

Thank you for any assitance.

Staff
10,317 Points
2014-10-23 6:21 pm
Hello Chad,

Thank you for your question. You can request that Google reconsiders crawling your website, which should update the older cached URLs.

Then, you will want to redirect the individual pages (for example logicweb.com/billing) first in your .htaccess file.

Then create a 404 redirect for any errors that occur similar to this:
ErrorDocument 404 http://example.com

In this example, anyone who gets a 404 error will be redirected to example.com.

If you have any further questions, feel free to post them below.

Thank you,
John-Paul
n/a Points
2014-10-23 10:31 pm

Very helpful indeed. Also much better than other links on google since this is easy to replace for ccTLDs

n/a Points
2014-10-24 6:47 am

Hi there,

I can't seem to find the answer to this after a lot of searching!

I have a domain for my business, but the old owners still had their website up saying that the business was closed.  I have just managed to purchase their old domain, which I have just imported.  The service I use only allows me hosting individually for each domain, so in order to set up a 301 redirect for the old domain, I would need hosting for it (which is a waste of money really).  I thought I could just point both domains at the same webspace, and put the 301 in to redirect from the old domain to the new, however it seems I can only use 301's for pages / directories rather than domains ... right?  So, I can't do this:

Redirect 301 oldsite.co.uk/index.htm http://newsite.co.uk/index.htm

Any help would be gratefully received as I'm going round in circles here!!

Nicola

Staff
20,166 Points
2014-10-24 7:43 am
Hello Nicola,

That is very odd that your host does not allow that. Do they allow you to edit an htaccess file? I am unsure of how to do what you are asking as I do not know what they have set up on their side. You would need to ask them how to work with their existing setup to accomplish that.

Kindest Regards,
Scott M
n/a Points
2014-10-30 11:36 am

First just want to say great article. Now for my question, I've tried everything and just can't get this to work. How would one redirect this?

/Dammit-Dolls---White/Flowers---Purple-Hair?sort=p.price&order=ASC&limit=50

to

http://www.shopthebeadcage.com/Dammit-Dolls

Thanks for your time.

Staff
10,317 Points
2014-10-30 2:43 pm
Hello Chris,

Thank you for your question. Since the folder is changing, most likely you would "Redirect individual files on the same domain" as explained above.

What CMS are you using, for example WordPress, Joomla, Drupal, etc. There may also be an easier way to do this within your CMS with a plugin/addon.

Thank you,
John-Paul
n/a Points
2014-10-30 3:56 pm

Hi John-Paul,

Thank you for taking the time to respond to my question. This would be OpenCart

Staff
10,317 Points
2014-10-30 4:19 pm
Hello Chris,

Thanks for letting us know you are using OpenCart. There are many Extensions available for handling 301 redirects in OpenCart.

You can narrow the search result down to your specific version, there is a drop down menu on the left where you can do that. You may have to test a few to decide which one you prefer.

If you have any further questions, feel free to post them below.

Thank you,
John-Paul

n/a Points
2014-10-31 1:55 am

Hello

          I want to redirect my url http://www.findmovers.in/top-packers-and-movers-in-gurgaon to http://www.findmovers.in/packers movers in gurgaon. but all by url genrate daynamicaly, last sement change daynamilcaly which is a city name. how i can apply 301 redirect for all my urls.

 

Staff
332 Points
2014-10-31 11:01 am
Hello Pradeep,

You would need to create a redirect for each domain however, it is not recommended to have spaces in your url as it can sometimes create issues with your http server. What kind of CMS are you using as there may be a plugin to do what you are looking to do.

Thank you,
TJ Edens
n/a Points
2014-10-31 8:00 pm

Hi guys!

It seems that you really knows about this. Thank you to help to so many people. My problem is... a long time ago I had a shopping cart and one link is linked in some external sites the link is http://www.cryo64.com/index.php?option=com_content&task=view&id=8&Itemid=26 but Some years ago I installed Zencart and the current link is "http://cryo64.com/store/wallpapers/levit-folder-manga". I'm trying REDIRECT but is not working. I have many others broken links to fix that start with "index.php?option=com_". Any clue? Thanks!

Staff
10,317 Points
2014-10-31 8:45 pm
Hello Dario,

Thank you for contacting us. It is possible existing rules in your .htaccess file are interfering with the redirect you are adding. You may have to look through your .htaccess file for something that conflicts with this rule.

Alternately, your CMS may control the redirects for your website and be overriding your rule. In Zen Cart the best option may be to use a 3rd party Module such as Ultimate SEO URLs, or Ceon URI Mapping (SEO)

If you have any further questions, feel free to post them below.
Thank you,
John-Paul
n/a Points
2014-10-31 10:46 pm

Yes! Actually I'm using Ceon URI Mapping (SEO) . Let me show you the content of my htaccess to see if you can tell me what is doing the conflict. For me is chinese language lol.  http://cryo64.com/myhtaccess.txt

Thanks for your help!

Staff
17,836 Points
2014-11-03 11:39 am
Hello Dario,

Sorry for the problems with the re-writes. It's difficult for us to troubleshoot this issue without access to the server that's hosting you. The suggestion I was given by a senior tech who looked at the issue with me was to disable your re-writes and then test the redirects. Try disabling them one at a time until you can determine what may be interfering with the redirect. If the problem persists you may want to contact your current host and ask to see if your re-directs are causing an issue that they can identify.

Otherwise, provide us some further information after disabling the re-writes. We're looking for specific information that would have to do with re-write affecting re-directs. Error messages that you're seeing would help.


Kindest regards,
Arnel C.
n/a Points
2014-11-03 1:44 pm

Hi Arn, thanks a lot for your help.

I added a txt with the .htaccess content so you can find where is the error. The file is http://cryo64.com/myhtaccess.txt Thanks a lot for your help. Unfortunately my host provider only help for errors related with the hosting. I would love to have a service like you are given us to who don't have an idea about this (like me). :)

Staff
17,836 Points
2014-11-03 2:38 pm
Hello Dario,

Sorry for the continued problems with the re-directs. When we troubleshoot them, we generally have control of the server so that we can see the rules that are working or not working based on what we have enabled or disabled. We can narrow down the cause of the problem using this approach. However, since your account is not related to an account with our hosting service, we cannot do this. You will need to delete or remove the re-writes - line by line and see what's happening with your redirect (does it work when a particular re-write is removed from your .htaccess file? We cannot do this for you because we have no access to your account.

Please step through procedure listed above in order to troubleshoot the problem. Please let us know if you have any further questions or comments.

Regards
Arnel C.
2014-11-05 1:51 am
Hello,

I renamed few pages on website to new ones:
http://mysite.com/oldname
to a
http://mysite/new-name

I tried all the possible ways of 301 redirect but I always got the same problem which look like this:
http://mysite.com/new-name=id?oldname
Or sometimes just leave it the same way without redirecting
http://mysite.com/oldname

The only other rule I have is redirect from www to non-www.

Is there something I am doing wrong?
Staff
17,836 Points
2014-11-05 10:23 am
Hello,

Sorry that you're having problems with the re-direct. Unfortunately, we can't tell what's wrong with your redirect without a little more information. Make sure that you're following our instructions on redirects: Setting up redirects in cPanel. You should be using a wildcard redirect since everything coming from your old site will be going to a corresponding file in another subdomain on your account.

If you want us to investigate it further, please provide your domain name or account user name and we would be happy to help.

Kindest regards,
Arnel C.
n/a Points
2014-11-07 12:54 am

hi

first of all congrats for your site,

 

how can i make a 301 redirection using a shorten URL? The thing it is that is imposible for us to make a 301 redirection from old site url " http://www.asanta.com/#!trabaja-con-nosotros/ccjb " to the new site url " http://www.asanta.com/empleo/ " . Then i thought maybe with a shorten code it could work, what do you think? could you please tell us how we could do that, or if it is not necessary and we're missing something.

It is now a wordpress site, and no plugins work for this... The thing it is that the APACHE thing is not supporting characters like " !?# ". Please help us, we are desperate!

Thanks for your time,

 

A. Santanawww.asanta.com

n/a Points
2014-11-07 1:08 am

I forgot to paste my default htaccess file generated by wordpress so you can have a better idea:# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule># END WordPress

 

Staff
332 Points
2014-11-07 10:44 am
Hello

This looks to mostly be done on the browser side on how it handles the #!. However you can try escaping the files such as \#\! . I did find a thread on Stack Overflow regarding the same issue someone else was having.
n/a Points
2014-11-07 4:19 pm

the thing it is that my website with "#!" it is in WIX. So i cannot go into the coding files. Now they offer a 301 redirection, which makes possible to make a user friendly URL go to the WIX URL: example: you can make /quienes-somos  and when user clicks on that, goes to /#!quienes-somos/gsdfg . But it is impossible this way to make the user friendly URLS popular for GOOGLE, since once in the website you have the ugly URLS again.

So, what could be the solution? double 301 redirection? i have to migrate to wordpress, and wix is not helping me at all.

 

Thanks so much

 

A. Santanawww.asanta.com

Staff
332 Points
2014-11-07 4:36 pm
Hello Adrian Santana,

Wix would not be able to assist with changing core Apache settings as it would change for everyone on their servers. However, I would recommend moving your website to Wordpress platform for better customization options.

Kindest Regards,
TJ Edens
n/a Points
2014-11-07 4:55 pm

so u mean there is no way i can do my 301 redirections properly?

 

Thanks

Staff
332 Points
2014-11-07 5:08 pm
Hello Adrian Santana,

According to a WIX support page I found, their 301 redirects only work one way. You can read more on it here.

Kindest Regards,
TJ Edens
n/a Points
2014-11-07 5:50 pm

i though maybe changing all links in the website, and instead of making them go to a part of the website ( WHO WE ARE= /#!WHOWEARE/GSDFG, making them go to the clean USER FRIENDLY URLS (/WHOWEARE) which will redirect the user to the UGLY WIX URL (/#!WHOWEARE/GSDFG), ir order to tell google users want the USER FRIENDL URLS. Could that work? I mean, could that make GOOGLE change their default indexed URLS? It is very important for us to save our SEO since it's been so hard to get where we are with our model agency.Thanks

Staff
332 Points
2014-11-07 6:09 pm
Hello Adrian Santana,

That should work for visible purposes however I found a Stack Overflow thread going over Google SEO and fragmented URLs. I would recommend going over that thread before making major changes that will possibly affect your SEO rankings.

Kindest Regards,
TJ Edens
n/a Points
2014-11-07 7:23 pm

why for visible purposes? if i get to make google offer my clean URLS in their results...when i'll move to WORDPRESS puting the same clean URLS, they will be indexed automatically i guess, won't they?

i think this is the only solution i can have, maybe i can try first with a concrete URL and see if google indexes it the right way, if not what do i do? I've been looking for a solution to this for weeks...if you know the way to do it with the .htaccess file please tell us. we will thank it so much, sorry for our english we're spanish, 

 

Thanks

Staff
332 Points
2014-11-07 7:41 pm
Hello Adrian Santana,

Yes they should be indexed for when you move your website over to Wordpress. If Google happens to index a bad URL then you can have it removed by following steps in how to remove a webpage from Google. I was not able to find an .htaccess solution for what you are trying to do.

Kindest Regards,
TJ Edens
n/a Points
2014-11-07 8:47 am

Hello,

I edit my htaccess file for 301 redirect:

/tin-tuc/may-tinh-bang-acer-iconia-a1.html http://blog.mysite.com/tin-tuc/may-tinh-bang-acer-iconia-a1.html

it's work ok but:

/product/bao-da-ultrabook http://mysite.com/bao-da-ultrabook.html

it not work

 

Please help me. Thanks

Staff
332 Points
2014-11-07 10:15 am
Hello Zaki,

For your second redirect are you trying to redirect a folder to a file? Can you provide your domain so we many look into it further by chance? Have you tried doing the following?

/product/bao-da-ultrabook.html http://mysite.com/bao-da-ultrabook.html

Kindest Regards,
TJ Edens
n/a Points
2014-11-08 10:07 am

If I want to have the .htaccess convert all of my .htm pages to .php and do the 301 redirect, is this the correct method?  Thanks!

RewriteEngine on 
RewriteBase/RewriteRule(.*).htm$ /$1.php [R=301,NC]

 

Staff
20,166 Points
2014-11-10 11:13 am
Hello Grillman3000,

What you have looks very close to what I have:
RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php


Give it a try and let us know.

Kindest Regards,
Scott M
n/a Points
2014-11-10 6:30 am

Hi I really hope you can help me please. I'm at my wits end helping a friend.

On old-domain-1.com redirecting all pages to 1 page seems to work##### REDIRECT THIS SITE TO away.html#RewriteCond %{REMOTE_ADDR} !^xxx\.x\.xxx\.xxxRewriteCond %{REQUEST_URI} !^/_css/.*$RewriteCond %{REQUEST_URI} !/away.html$ [NC]RewriteRule .* /away.html [R=301,L]

Now I'm trying to redirect everything at old-domain-2 to old-domain-1/message.html#redirect to other site, message.htmlRewriteEngine onRewriteCond %{HTTP_HOST} ^old-domain-2.comRewriteRule ^(.*)$ http://old-domain-1.com/message.html [L,R=301]

This never works because I can't work out to let message.html load in the first redirection.

Will truly appreciate any help, thanksKK

n/a Points
2014-11-10 8:18 am

Hey

I am beginer just learning Php these days. I'd like to simply place permanent redirection rule.

Currently my site is opening with both www.abc.com and abc.com. I'd like to place a which rule ?

Is below mentioned rule is correct ? Please advice

RewriteEngine on rewritecond %{http_host} ^abc.com [nc] rewriterule ^(.*)$ http://www.abc.com/$1 [r=301,nc]

 

Staff
20,166 Points
2014-11-10 11:24 am
Hello Vineet,

We have an article about forcing www for your website. That will help you accomplish what you are looking for.

Kindest Regards,
Scott M
n/a Points
2014-11-12 1:10 pm

Thanks i have been looking for this information but i have an issue with this rule:

 Redirect 301 /index.php?Itemid=571 /contact-us

The above didnt work question 1 is this correct, second where do i add this line in the htaccess file?

 

 

 

 

 

Staff
17,836 Points
2014-11-12 2:20 pm
Hello Jay,

Thanks for the question. A Redirect rule only uses URL paths as criteria, excluding the query string. If you want to use the query string as part of the re-direct, you need to use a mod_rewrite.

If you want to match some query string and redirect all URLs to some other URL, use a RewriteCond together with a RewriteRule. Try this out:

RewriteEngine On
RewriteCond %{QUERY_STRING} Itemid=571
RewriteRule .* /contact-us [R=301]


I hope this helps to resolve your problem! Please let us know i you have any further questions or comments.

Regards,
Arnel C.
n/a Points
2014-11-12 3:52 pm

I recently changed my htaccess file to make some dynamic urls more search engine friendly. For instance I changed www.example.com/search.php?query=truck to www.example.com/search/truck.php. I used the following htacess code to do this :

Options +FollowSymLinks

RewriteEngine on

RewriteRule search/(.*)/\.php search.php?query=$1

RewriteRule search/(.*)\.php search.php?query=$1

The above allows me to reach the example.com/search/truck.php, but I'm still confused on how to get queries from users using our site to go to the new url structure over the old one. For instance I have to manually enter example.com/search/truck.php for my browser to go there. We have a search form on the site that provides query results from our database. Since I have the SEF URL setup how do I redirect these queries to the SEF version I've already setup.

Hopefully this makes sense :-)

Thanks,

Matt

Staff
17,836 Points
2014-11-12 4:10 pm
Hello Matt,

Thanks for the question. The problem you're having has to do with making sure that ALL of your URL re-writes or re-directs are put in place in your .htaccess file. These should be done with the Search Engine Friendly URLs in mind. In general - depending on the software you're using to create/run your website - this can be done from the program. For example, PrestaShop has an option that you can simply click and then it uses SEF urls. These are accomplished through code and rewrites/redirects. I can't give you specifics because providing the complete re-write or redirect code to get your site to use your SEF URLs would be beyond the scope of our support. In some cases, programs like WordPress offer plugins that provide the changed URLs for you. If your site is not that large, then you may be surprised at how many re-write rules it would take to make your website use your SEF urls - it might be far less than you think. Again, this all depends on how many SEF urls you're trying to use and how many pages you're trying to re-direct.

I hope this helps to explain the issue for you. In the case of trying to account for your entire SEF structure, you would need to provide the necessary re-direct/re-write rules to account for all of the paths that you wish to use for your website.

Kindest regards,
Arnel C.
2014-11-12 4:18 pm
Arn,
Thanks for your speedy answer (I signed up for a support name so my user name is now poultonweb). I'll continue to research this, thanks for your insight.
Matt
n/a Points
2014-11-18 2:57 pm

I am trying to redirect my site from www to no www I used:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.emudevs.com [NC]

RewriteRule ^(.*)$ http://emudevs.com/$1 [L,R=301,NC]

 

But it gives me a redirect loop, any thoughts?

 

Staff
9,479 Points
2014-11-18 3:27 pm
How is your website built? Many content management systems such as WordPress have their own way of directing content which would cause this redirect loop when redirecting back using .htaccess.
n/a Points
2014-11-18 3:37 pm

I run through vBulletin, but I just switched my site to Apache mode instead of FCGI and it works now. Not sure why it loops through CGI.

n/a Points
2014-11-18 4:24 pm

Hi Arn, that help but were in the file do i add this code?

Staff
9,479 Points
2014-11-18 5:58 pm
Typically, you would place it within the top of your .htaccess file.
n/a Points
2014-11-18 7:01 pm

I need to write an htaccess for a tricky domain.

route

domain.org (all route files need to redirect to domain.com)

trickypart

several subfolders/domains with wordpress installations

domain.org/studentcenterone (must stay as is)

domain.org/studentcentertwo(must stay as is)

domain.org/anothersubdomainone (must stay as is)

domain.org/anothersubdomaintwo (this one should redirect)

domain.org/orgba123 is returning error 404 pages everywhere I turn (wordpress install because a different developer copied the install instead of moving it and only redirected the homepage to the domain.com - need entire directory to go to domain.com

Help? can it be done?

Staff
9,479 Points
2014-11-18 7:09 pm
To do so, simply create those folders that you need to redirect elsewhere, then place the redirect that is mentioned in this article inside each of these folders, adjusting for of course the redirect locations.
n/a Points
2014-11-18 7:17 pm

but how does that work for the main route of the domain then.

if domain.org has a htaccess that redirects to domain.com

anything on domain.org then redirects to domain.com those subdomains included, is there not a and/or statement that can be added in the htaccess to tell it to skip those folders/subdomains?

 

Staff
9,479 Points
2014-11-18 7:41 pm
I may be misunderstanding your question. Are you attempting to only redirect specific directories, or redirect everything excluding specific directories?
n/a Points
2014-11-18 7:51 pm

a little of both really

domain.org needs to redirect to domain.com

but domain.org/studentcenterone stays as is

domain.org/studentcentertwo stays as is

domain.org/orgba123 redirects to domain.com (route not subdomain)

does that help?

Staff
9,479 Points
2014-11-18 8:18 pm
This should get you started:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/studentcenterone/
RewriteCond %{REQUEST_URI} !^/studentcentertwo/
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]



The .htaccess rules above should redirect all content to the new domain, with the exception of the folders listed.
2014-11-21 6:59 am
Hi JeffMa, I need an emergency help in .htaccess. I need to redirect all the URLs of the old website to the index page of new website. I am using Wordpress for developing the websites. Hop you will give the answer and thanks in advance....

n/a Points
2014-11-18 9:11 pm

thank you very much that worked like a charm

n/a Points
2014-11-19 6:08 am

hi!!

 

when i am using following urlhttp://www.bothouniversity.ac.bw/

then its working fine but when i romve www in above url it redirect to the older site

http://www.bothouniversity.co/botho2014/

Staff
17,836 Points
2014-11-19 11:19 am
Hello Vikas,

Sorry for the problem with the re-direct. There are unfortunately many different possible causes for the URL not to work. You should start with checking your .htaccess file and also make sure that you do not have any DNS recordss that may be re-directing the URL minus the WWW.

I did try to test the URLs you provided, but neither of them connect. If you can provide more info on your .htaccess file, then we can try to see if there is a problem.

Kindest regards,
Arnel C.
n/a Points
2014-11-21 10:33 am

When i add the follwoing code at the top of the page i get a a loop error, the site is based on joomla, any ideas?  I ahve a number of pages to do and this is taking for ever i realy need som help in bypassing the error?

 

RewriteEngine On RewriteCond %{QUERY_STRING} Itemid=571 RewriteRule .* /contact-us [R=301]

 

 

 

 

Staff
332 Points
2014-11-21 10:45 am
Hello Jay,

Have you tried using any Joomla plugins to perform the redirect for you? I found some Joomla Extensions that should help ease your problem.

Kindest Regards,
TJ Edens
n/a Points
2014-11-21 11:44 am

I already tried a number for 2.5 and dont work do you have a recommdation, i dont want to change all the urls, just 20 pages or so

Staff
332 Points
2014-11-21 12:06 pm
Hello Jay,

I have used the plugin Simple Redirect to redirect articles to other pages before. I would suggest giving this a try first.

Kindest Regards,
TJ Edens
n/a Points
2014-11-21 12:08 pm

im not sure if we are on the same page but i want google or the user to see a url in a sef way so not just redirect the url but to change the url competely i dont really want ot use a joomla extension as im only changing a few urls, is this what we call a 301 redirect? if so how do i add the rule in the htaccess with out getting the joomla loop error

 

So instead of see this in the broswer

/job-search/simple-search/guest/jobsby_criteria/jobcateg/1-accountancy-jobs

 

Search engines and users see this in the broswer SEF version

/1-accountancy-jobs

Staff
332 Points
2014-11-21 12:23 pm
Hello Jay,

Something such as the code Im providing below should be sufficient to solve your redirect issue.

Redirect 301 /job-search/simple-search/guest/jobsby_criteria/jobcateg/1-accountancy-jobs /1-accountancy-jobs

Could you provide us your domain so we may try to troubleshoot further?

Kindest Regards,
TJ Edens
n/a Points
2014-11-21 3:01 pm

hi the site in questions is http://www.pure-jobs.com joomla platform, so just adding the above code is not working as it giving me a loop error, please help?

Staff
332 Points
2014-11-21 4:22 pm
Hello Jay,

I was not able to replicate a loop issue with the redirect. You may want to contact the technical department who manage your server as there may be other rewrites causing issues. I would recommend backing up your .htaccess and start fresh with the re-writes.

Kindest Regards,
TJ Edens

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

235 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!