www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Site Management > Server Management

    Server Management Apache, Windows, .htaccess, and more

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 11-18-2009, 04:34 PM
    etard etard is offline
    Registered User
     
    Join Date: Sep 2003
    Posts: 249
    resolved [RESOLVED] URGENT help needed: .htaccess not forwarding!

    Apache linux server hosted on GoDaddy, I have an .htaccess file that points old URLs to new URLs as we just rebuilt the site. It does not work as hit an old page and you just get the 404 page and not redirected to the new page location. I fear, if we do not get on this quick, we will loose SE placement for links we have in the search engines.

    here is the first part of the file.. it has about 20 more lines exactly the same. do you see an error? I do not. Seems perfectly setup. This must be some server issue, no? Thoughts?

    PHP Code:
    Redirect 301 index.html http://www.website.com/index.php
    Redirect 301 about/articles.html http://www.website.com/about/press.php
    Redirect 301 about/certs.html http://www.website.com/about/certificates.php
    Redirect 301 about/index.html http://www.website.com/about/index.php
    Redirect 301 about/mems.html http://www.website.com/about/index.php
    Redirect 301 contact/area.html http://www.website.com/contact/index.php
    Redirect 301 contact/index.html http://www.website.com/contact/index.php
    Redirect 301 faqs/index.html http://www.website.com/index.php
    all this is in a txt file with name .htaccess.txt and then FTP to the server and then rename to .htaccess where it becomes invisible. Though, I do use an FTP app that allows me to see invisible files. So, I know it is there, name is correct.

    Last edited by etard; 11-18-2009 at 05:08 PM.
    Reply With Quote
      #2  
    Old 11-18-2009, 05:00 PM
    donatello's Avatar
    donatello donatello is offline
    Registered User
     
    Join Date: Jun 2008
    Location: Europe
    Posts: 558
    YOU MUST NOT SAVE IT AS .htaccess.txt

    JUST .htaccess


    The file has no name.
    If you are editing it in Notepad, make sure to set the file name as simply this:

    .htaccess


    Make sure that you save it as ALL FILES, NOT TEXT!!!!

    AGAIN:
    NO NO NO: .htaccess.txt
    YES! .htaccess

    Last edited by donatello; 11-18-2009 at 05:02 PM. Reason: clarification
    Reply With Quote
      #3  
    Old 11-18-2009, 05:07 PM
    etard etard is offline
    Registered User
     
    Join Date: Sep 2003
    Posts: 249
    I use a mac, so I open TextEdit and then save - Unicode UTF-8 - it to the desktop as .htaccess - but "." is reserved for system files, so I have to use an app that lets me see hidden files on the desktop. I can then grab it and carry it to the server.

    btw, are you understanding that it is NOT on the server as .htaccess.txt?? I just save it that way locally so I can work on it because of above issue. once I transfer it to the server, I rename it to just .htaccess

    Last edited by etard; 11-18-2009 at 05:09 PM.
    Reply With Quote
      #4  
    Old 11-18-2009, 05:08 PM
    donatello's Avatar
    donatello donatello is offline
    Registered User
     
    Join Date: Jun 2008
    Location: Europe
    Posts: 558
    I remember for godaddy, there were different ways of writing them...

    Hang on... I did one for godaddy that redirected all old/dead pages to the homepage instead of a 404

    Here is my .htaccess that works on Godaddy to redirect all dead pages to our homepage instead:

    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Last edited by donatello; 11-18-2009 at 05:15 PM.
    Reply With Quote
      #5  
    Old 11-18-2009, 05:18 PM
    etard etard is offline
    Registered User
     
    Join Date: Sep 2003
    Posts: 249
    as expected.. I went over to a PC and did it the way you said.. does not work. One can make an .htaccess file on a mac or pc. TextEdit or Notepad should not matter. also, I think you helped me with a php issue I had that required a .htaccess file and I made like I made this first one and it worked fine. but in this case.. it is not working. almost makes me wonder if it is a server issue.
    Reply With Quote
      #6  
    Old 11-18-2009, 05:22 PM
    etard etard is offline
    Registered User
     
    Join Date: Sep 2003
    Posts: 249
    Quote:
    Originally Posted by donatello View Post
    I remember for godaddy, there were different ways of writing them...

    Hang on... I did one for godaddy that redirected all old/dead pages to the homepage instead of a 404

    Here is my .htaccess that works on Godaddy to redirect all dead pages to our homepage instead:

    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    but that is a full site redirect, why wouldn't you want to do page by page, one by one and get the pages sent to their correct new page and not generically the home page. I mean, if it is a custom 404 page or the home page, does that really matter? the goal would be to get old pages sent to their new page location, no?
    Reply With Quote
      #7  
    Old 11-18-2009, 05:27 PM
    donatello's Avatar
    donatello donatello is offline
    Registered User
     
    Join Date: Jun 2008
    Location: Europe
    Posts: 558
    Red face

    My script was for after we discarded a lot of old stuff, such as old newsletters taken offline, etc.


    I remember that there was a slightly different rewrite for godaddy for some reason...

    Sorry I cannot be of much more help...


    Maybe search for a Godaddy specific solution for this. Add "Godaddy" to your search string... there must be something out there at hand...
    Reply With Quote
      #8  
    Old 11-18-2009, 05:27 PM
    etard etard is offline
    Registered User
     
    Join Date: Sep 2003
    Posts: 249
    when I use your method, it redirects to the home page BUT the page does not load the CSS file and so the page is just text. if I go back to my version, it allows the nice custom 404 page to be found, but does not redirect them to the right new page!! how is that even possible. it is like the .htaccess file is recognized, since your kicked it over to the splash page al right, but something is whack in that the splash page has no css and yet my version kicks them to the 404 page which looks perfect, but does not kick them to the correct NEW page.
    Reply With Quote
      #9  
    Old 11-18-2009, 05:28 PM
    donatello's Avatar
    donatello donatello is offline
    Registered User
     
    Join Date: Jun 2008
    Location: Europe
    Posts: 558
    Quote:
    Originally Posted by etard View Post
    as expected.. I went over to a PC and did it the way you said.. does not work. One can make an .htaccess file on a mac or pc. TextEdit or Notepad should not matter. also, I think you helped me with a php issue I had that required a .htaccess file and I made like I made this first one and it worked fine. but in this case.. it is not working. almost makes me wonder if it is a server issue.
    I would be willing to bet it's a GODADDY issue,

    but do not despair, you can get EVERYTHING to work on Godaddy...

    sometimes it takes an alternate .htaccess file, or a php.ini file.
    Reply With Quote
      #10  
    Old 11-18-2009, 05:30 PM
    donatello's Avatar
    donatello donatello is offline
    Registered User
     
    Join Date: Jun 2008
    Location: Europe
    Posts: 558
    Did you try:
    HTML Code:
    RewriteEngine on
    rewritecond %{http_host} ^coolexample.com [nc]
    rewriterule ^(.*)$ http://www.coolexample.com/$1 [r=301,nc]
    Reply With Quote
      #11  
    Old 11-18-2009, 05:32 PM
    donatello's Avatar
    donatello donatello is offline
    Registered User
     
    Join Date: Jun 2008
    Location: Europe
    Posts: 558
    Quote:
    Originally Posted by etard View Post
    when I use your method, it redirects to the home page BUT the page does not load the CSS file and so the page is just text. if I go back to my version, it allows the nice custom 404 page to be found, but does not redirect them to the right new page!! how is that even possible. it is like the .htaccess file is recognized, since your kicked it over to the splash page al right, but something is whack in that the splash page has no css and yet my version kicks them to the 404 page which looks perfect, but does not kick them to the correct NEW page.
    Strange, works fine on a page I put it on (not mine)...

    Check it out here:
    http://www.gladstonellc.com

    You can write any jibberish after the URL and it will go to the homepage... with a message that the page you seek has been moved...
    http://www.gladstonellc.com/yada-yada

    For this site, this was a perfect solution as much old and dated material was finally cleared out for new content... old company newsletters, photos, etc.

    Works.

    Last edited by donatello; 11-18-2009 at 05:34 PM. Reason: spelling :(
    Reply With Quote
      #12  
    Old 11-18-2009, 05:34 PM
    etard etard is offline
    Registered User
     
    Join Date: Sep 2003
    Posts: 249
    Quote:
    Originally Posted by donatello View Post
    My script was for after we discarded a lot of old stuff, such as old newsletters taken offline, etc.


    I remember that there was a slightly different rewrite for godaddy for some reason...

    Sorry I cannot be of much more help...


    Maybe search for a Godaddy specific solution for this. Add "Godaddy" to your search string... there must be something out there at hand...
    I contacted GD... and drum roll... they will not support or give .htaccess information!!

    google the topic and you will see that GD is a known PITA on this topic.

    Last edited by etard; 11-18-2009 at 05:43 PM.
    Reply With Quote
      #13  
    Old 11-18-2009, 05:38 PM
    etard etard is offline
    Registered User
     
    Join Date: Sep 2003
    Posts: 249
    Quote:
    Originally Posted by donatello View Post
    Did you try:
    HTML Code:
    RewriteEngine on
    rewritecond %{http_host} ^coolexample.com [nc]
    rewriterule ^(.*)$ http://www.coolexample.com/$1 [r=301,nc]
    same result as mine.. gives me the default custom 404 page, but not the splash page
    Reply With Quote
      #14  
    Old 11-18-2009, 05:39 PM
    donatello's Avatar
    donatello donatello is offline
    Registered User
     
    Join Date: Jun 2008
    Location: Europe
    Posts: 558
    Never mind

    Our posts crossed in cyberspace... deleted mine as it would confuse...

    Last edited by donatello; 11-18-2009 at 05:40 PM. Reason: never mind...
    Reply With Quote
      #15  
    Old 11-18-2009, 05:43 PM
    donatello's Avatar
    donatello donatello is offline
    Registered User
     
    Join Date: Jun 2008
    Location: Europe
    Posts: 558
    BINGO!!!!

    I remember!!!

    Wait until the TOP OF THE HOUR!!!
    I forgot all about this as it drove me MAD once!!!

    Go and have a beer or coffee and come back at 1 minute after the hour...




    Quote:
    NOTE: Due to server caching, new .htaccess files may take up to one hour to be recognized.
    Changes to existing .htaccess files are picked up immediately.
    http://help.godaddy.com/article/1641?isc=isc_code
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 01:24 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.