+ Post New Thread
Results 1 to 3 of 3

Thread: .htaccess how redirect one page to another

  1. #1
    Administrator
    Join Date
    Mar 2013
    Posts
    2,789

    .htaccess how redirect one page to another

    If you have one subpage and you wish to redirect all traffic to another page, you can use this code in .htaccess file


    redirect 301 /page.php http://domain.com/page.php
    Note that old page is only /page.php or page.php , not http://

    then if you need to redirect including URL parameters (page.php?name=john&surname=doe) you can redirect .php page to a different page with same parameters using following .htaccess file lines:

    RewriteEngine on
    RewriteRule ^local-source-page\.php$ https://new.domain.tld/newpage.php [L,R=301]

    You can also use redirect htaccess generator like http://www.rapidtables.com/web/tools/redirect-generator.htm
    There is whole domain redirect: http://internetlifeforum.com/editing-coding-programming/1645-htaccess-redirect-old-domain-new-domain-index/
    Last edited by Fli; 07-04-2024 at 01:36 PM.

  2. #2
    Junior Member John8's Avatar
    Join Date
    Nov 2013
    Posts
    10


    Is this useful / helpfull? Yes | No
    You can ADD this to your .htaccess and redirect non www to www... This will help your SEO because google will not be able to get duplicate cotent

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

  3. #3
    Senior Member
    Join Date
    Jul 2019
    Location
    USA
    Posts
    220


    Is this useful / helpfull? Yes | No
    To redirect one page to another using .htaccess, use the following code:

    Redirect 301 /old-page.html http://www.example.com/new-page.html.

    Replace "/old-page.html" with the relative path of the old page and "http://www.example.com/new-page.html." with the full URL of the new page you want to redirect to. The "301" indicates a permanent redirect.
    bodHOST | Linux VPS Hosting | 24x7 Support
    Web Hosting @$0.99/mo

+ Post New Thread

Similar Threads

  1. What method do you use to redirect a page?
    By gitanistone in forum SEO - Search Engine Optimisation
    Replies: 6
    Last Post: 11-08-2019, 03:58 AM
  2. How To Redirect Web Page ..?
    By indiaastro in forum SEO - Search Engine Optimisation
    Replies: 7
    Last Post: 08-01-2019, 07:12 AM
  3. Redirect HTTP to HTTPS .htaccess rule
    By Fli in forum HTML,CSS, Javascript Coding & Programming
    Replies: 0
    Last Post: 02-21-2017, 01:26 PM
  4. Replies: 0
    Last Post: 06-16-2015, 08:48 AM
  5. .htaccess redirect old domain subpages to new domain index
    By Fli in forum HTML,CSS, Javascript Coding & Programming
    Replies: 0
    Last Post: 03-21-2014, 12:24 PM

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
  •  
 Protected by : ZB BLOCK  &  StopForumSpam