+ Reply to Thread
Results 1 to 4 of 4

Thread: 2 ways to create a 301 Redirect

  1. #1
    hcse26's Avatar
    hcse26 is offline x10Hosting Member hcse26 is an unknown quantity at this point
    Join Date
    Oct 2008
    Location
    Doha, Qatar / Muntinlupa City, Philippines
    Posts
    94

    2 ways to create a 301 Redirect

    Redirecting with PHP

    PHP Code:
    <?
    Header
    "HTTP/1.1 301 Moved Permanently" );
    Header"Location: http://www.new-url.com" );
    ?>
    Copy the source code and edit "http://www.new-url.com" with your own url and save it as a .php file

    301 Redirect with .htaccess

    Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
    The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

    PHP Code:
    Options +FollowSymlinks
    RewriteEngine on
    rewritecond 
    %{http_host} ^domain.com [nc]
    rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] 
    Please REPLACE domain.com and www.newdomain.com with your actual domain name.

    Live demo[my site]: http://www.craigafer14.co.uk
    Notice that you got redirected to http://.craigafer14.co.uk

    Hope these helped and please rep me if they did

  2. #2
    Parsa44 is offline x10 Sophmore Parsa44 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    232

    Re: 2 ways to create a 301 Redirect

    Thanks i think it will come in rather handy for me XD, (if i dont get my DRK from my host)

  3. #3
    balaji2u's Avatar
    balaji2u is offline x10 Lieutenant balaji2u is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    Senthamil Nadu,India
    Posts
    410

    Re: 2 ways to create a 301 Redirect

    Great tutorial, If you are looking for a quick solution for the mod_rewrite tool you can try using http://www.webmaster-toolkit.com/mod...enerator.shtml it just takes your dynamic URL as an input and generates URL either on directory structure or on a file structure.
    Submit your Site Links Now ! >>> :cool:
    Live Aritlces Free Articles and Links Directory


  4. #4
    sam_m_w is offline x10Hosting Member sam_m_w is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    11

    Re: 2 ways to create a 301 Redirect

    Thanks guys it real helps

+ Reply to Thread

Similar Threads

  1. Replies: 6
    Last Post: 12-17-2010, 08:35 PM
  2. Create your own free forum using x10Hosting
    By Gigacore in forum Tutorials
    Replies: 46
    Last Post: 12-01-2008, 03:07 PM
  3. how do i create a redirect
    By [BAK]ThePro in forum Scripts & 3rd Party Apps
    Replies: 6
    Last Post: 05-21-2008, 03:32 AM
  4. Redirect
    By BlueIce in forum Free Hosting
    Replies: 3
    Last Post: 10-21-2007, 08:06 AM
  5. 8 Ways a Competitor Can Sabotage Your Site
    By oeminchina in forum Computers & Technology
    Replies: 4
    Last Post: 09-17-2007, 08:34 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers