htaccess Redirect Single URL to New Address

Hello everybody, few days ago I have deleted a post but  that post has back link from other site. When  somebody come through that  address to my site, they got 404 page! Well, then I added a simple  line on my .htaccess file to redirect all visitor of that post to a new related post. Well lets see that how to redirect a old post link into a new link.

In my case, the line was as follow

Redirect 301 /?p=1120 /2011/02/add-font-in-menubar-of-microsoft-word/

Where  /?p=1120 is a old page looks like and I have redirect it into the new address /2011/02/add-font-in-menubar-of-microsoft-word/which is actually

Since the new page is also on the same server, is used /2011/02/add-font-in-menubar-of-microsoft-word/ on the 2nd value.

Redirect is actually say to server that server need to redirect a url to another and the basic syntax is

Redirect 301 /old-page/ /new-page/

Where 301 says that the old page is moved permanently to the new page

/old-page/ is the page what will be redirect and /new-page/ is the page where the old-page will be redirect.

Well, I hope you understand the above. Now if you want to redirect page to a new site or that page is not in the same site, follow

Redirect 301 /old-page/

Here, replace with your site where you want to go your visitor.

Now you are ready to Redirect Single URL to new web page or new address

So... find your broken link and redirect to the link.

* htaccess is actually a file name and what we write there is accordingly as rewrite mode module. mod_rewrite is a module uses a rule-based rewriting engine for Apache Server that tell to the server to react accordingly as instruction of .htaccess file.

Related Post

Responsive isotope version 2 masonry layout Isotope is a nice script to organize and filter your portfolio or gallery item with some cool effects and functionality like masonry  layout support. ...
Text to Image converter php script Protect Email ID Hi there, I did this project 1 year back and the first article about this script was in bangle. Today I will write that into English.  I prepared that...
Split domain name into sld and tld – php script A series of alphanumeric strings that are separated by periods, such as, that is an address of a computer network connection and tha...
How to recover WP password installed on localhost I was looking for how to recover WordPress password installed on localhost. I got a way to recover, You may like it. Well, let us know how to do that....

One thought on “htaccess Redirect Single URL to New Address”

  1. Hello, can you tell me how to protect image with htaccess. I have seen that if any one call image from your site, they always got same image that hotlink failed!. please share with us.

Leave a Reply

Your email address will not be published. Required fields are marked *