Results 1 to 8 of 8

Thread: .htaccess All Page Redirect

  1. #1
    ProxySites.ca's Avatar
    ProxySites.ca is offline Newbie Net Builder
    Join Date
    Jul 2009
    Location
    ProxySites.ca
    Posts
    241
    Thanks
    29
    Thanked 3 Times in 3 Posts

    .htaccess All Page Redirect

    I have a very simple .htaccess question

    I want to direct all traffic that travels to a non existing page to be forwarded to the homepage.

    So if I make a spelling mistake in typing in the sub directory it will take me to the home page.

    How can I do this?

  2. #2
    Aziz's Avatar
    Aziz is offline no investment, no glory
    Join Date
    May 2009
    Location
    IL
    Posts
    736
    Thanks
    588
    Thanked 243 Times in 168 Posts
    Hey there. there are many methods you can do to achieve this redirection and the easiest is the following:

    Open .htaccess with a text editor and add the following line
    of course, you need to edit the URL to your homepage
    Code:
    ErrorDocument 404 http://www.example.com
    hopefully this information was useful. if you ran into troubles let me know!

  3. Thanked by:

    ProxySites.ca (23 January, 2010), rickyponting66 (28 May, 2010), Will.Spencer (25 January, 2010)

  4. #3
    ProxySites.ca's Avatar
    ProxySites.ca is offline Newbie Net Builder
    Join Date
    Jul 2009
    Location
    ProxySites.ca
    Posts
    241
    Thanks
    29
    Thanked 3 Times in 3 Posts
    perfect thanks man!

  5. #4
    nux
    nux is offline Moderator
    Join Date
    Dec 2008
    Location
    Minneapolis
    Posts
    534
    Thanks
    28
    Thanked 77 Times in 54 Posts
    Another way to do it would be:

    RewriteRule ^wd/wws/index.html(.*) URLto301to [R=permanent,L]

    In this case there were links to http://www.md5.net/wd/wws/index.html. I redirected just that without essentially breaking all 404s.
    Last edited by nux; 18 February, 2010 at 20:38 PM.
    Submit Your Proxies @ NewProxySites.com

  6. #5
    Andy101's Avatar
    Andy101 is offline Code Otaku
    Join Date
    Aug 2009
    Location
    Kanazawa
    Posts
    1,180
    Thanks
    163
    Thanked 298 Times in 225 Posts
    There's another way that Wordpress uses to redirect any non-existing pages to the script for implementing SE friendly URLs. But I don't know the exact code to solve the above problem.

    Aziz's 404 redirect seems like the simplest method to me, and it is taking care of the fact that the incorrect URL was initially entered by mistake. Maybe with 301 it could be regarded as a correct URL?

  7. #6
    soft-industry is offline Unknown Net Builder
    Join Date
    Apr 2010
    Posts
    3
    Blog Entries
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts
    This is another way to do it:

    RewriteRule ^.*$ index.php [QSA]

    --
    Web: soft-industry.com
    E-Mail: support@soft-industry.com
    Skype Isupport.soft-industry.com

  8. #7
    rickyponting66 is offline AboutWebmaster Owner
    Join Date
    Mar 2010
    Location
    behind you!!
    Posts
    122
    Thanks
    29
    Thanked 9 Times in 8 Posts
    Quote Originally Posted by Aziz View Post
    Hey there. there are many methods you can do to achieve this redirection and the easiest is the following:

    Open .htaccess with a text editor and add the following line
    of course, you need to edit the URL to your homepage
    Code:
    ErrorDocument 404 http://www.example.com
    hopefully this information was useful. if you ran into troubles let me know!
    thanks, helped me also

  9. #8
    Leftfield's Avatar
    Leftfield is offline Free The Robots
    Join Date
    May 2010
    Location
    Budva, Montenegro
    Posts
    31
    Thanks
    7
    Thanked 12 Times in 11 Posts
    @ProxySites.ca

    Redirecting all 404 links to the home page will give you negative points in SERP.

Similar Threads

  1. .htaccess / redirect to 'www.'
    By Snak3 in forum On-Site SEO
    Replies: 12
    Last Post: 30 December, 2009, 19:13 PM
  2. .htaccess
    By dodolls in forum Managing
    Replies: 6
    Last Post: 15 November, 2009, 06:58 AM
  3. Replies: 1
    Last Post: 18 October, 2009, 03:31 AM
  4. .htaccess help needed - dynanmic redirect
    By DomainMagnate in forum Programming
    Replies: 13
    Last Post: 27 September, 2009, 11:52 AM
  5. .htaccess - How to properly redirect a domain?
    By Shenron in forum Programming
    Replies: 10
    Last Post: 9 January, 2009, 08:30 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •