Activity Stream
48,167 MEMBERS
62567 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 7 of 7
  1.     
    #1
    Member
    Website's:
    WarezME.org

    Exclamation .htaccess redirect

    Hi,

    Anyone willing to help on a thing or two...

    I would like to redirect ALL 404 error pages from a domain to a subdomain.

    So like:
    Code: 
    www.page.com/post2857html
    On error would go on to :

    sub.page.com/post2857.html

    Cheers!
    batori Reviewed by batori on . .htaccess redirect Hi, Anyone willing to help on a thing or two... I would like to redirect ALL 404 error pages from a domain to a subdomain. So like: www.page.com/post2857html On error would go on to : Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Try this:

    ErrorDocument 404 /

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^([a-z0-9\-]+)\.domain\.com$ [NC]
    RewriteCond %1 !^www$ [NC]
    RewriteRule (.*) http://domain.com/%1 [R=301,L,NC]
    put that in your .htaccess on your root folder. This will redirect sub.domain.com => domain.com/sub

  4.     
    #3
    Member
    Website's:
    WarezME.org
    Thanks for the help and quick reply.

    I've tried it and it does not seem to work

    I need to redirect 404 error when they occur : MYDOMAIN.COM/mypost.html to TEST.MYDOMAIN.COM/mypost.html

  5.     
    #4
    Member
    Oh dam, I posted the opposite I guess.

  6.     
    #5
    Member
    Website's:
    WarezME.org
    Im a noob on this ... i can't make the opposite

  7.     
    #6
    Member
    Website's:
    phiferindia.com saspapercupmachine.com
    batori..I think this website - www.404errorpages.com will give you a detailed information on 404 pages.

  8.     
    #7
    Respected Member
    You can also add your own 404.shtml file to redirect a page not found. Usually the cpanel has an icon to do that. Or do it manually.


    for the .htaccess try this:
    Code: 
    ErrorDocument 404 /
    
     RewriteEngine On 
     RewriteBase / 
     RewriteCond %{HTTP_HOST} ^([a-z0-9\-]+)\.domain\.com$ [NC]
     RewriteCond %1 !^www$ [NC]
     RewriteRule (.*) http://test.domain.com/%1 [R=301,L,NC]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 14th Dec 2013, 07:16 AM
  2. Redirect from one site to another site using .htaccess
    By NaHoW in forum Web Application/Script Support
    Replies: 0
    Last Post: 17th Sep 2012, 05:37 PM
  3. .htaccess 302 redirect
    By av0id in forum Technical Help Desk Support
    Replies: 2
    Last Post: 6th Mar 2012, 01:52 AM
  4. How to Redirect using htaccess
    By AJ Blacklisted in forum Web Application/Script Support
    Replies: 4
    Last Post: 20th Dec 2011, 08:38 AM

Tags for this Thread

BE SOCIAL