1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

mod rewrite and 404 error

Discussion in 'PHP' started by jred2002, Jan 25, 2008.

  1. #1
    Hello,

    I was previously on a shared server running a Article Dashboard site with PHP Version 4.4.4
    and my .htaccess file looked this
    PHP:
    1.  
    2. # -FrontPage-
    3.  
    4. IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    5.  
    6. <Limit GET POST>
    7. order deny,allow
    8. deny from all
    9. allow from all
    10. </Limit>
    11. <Limit PUT DELETE>
    12. order deny,allow
    13. deny from all
    14. </Limit>
    15.  
    16. #php_flag session.use_trans_sid off
    17.  
    18. RewriteEngine On
    19.  
    20. RewriteCond %{HTTP_HOST} .
    21. RewriteCond %{HTTP_HOST}  !^www\. [NC]
    22. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1  [R,L]
    23.  
    24. RewriteRule ^profile\/([^\/]+)/([0-9]+)     publicprofile.php?name=$1&id=$2    
    25. RewriteRule ^Category\/[^\/]+/([0-9]+)      index.php?catid=$1&mode=category    
    26. RewriteRule ^Article/[^\/]+/([0-9]+)/?(.*)  article.php?id=$1&act=$2            
    27. RewriteRule ^rss/[^\/]+/([0-9]+)            rssarticle.php?id=$1                
    28. RewriteRule ^myarticles/(.*)$               index.php?mode=myarticles
    29.  
    30. RewriteRule ^(.*)topauthorslist/      topauthors.php?orderby=$1&ordertype=$2&namelike=$3&page=$4
    31. RewriteRule ^(.*)popularlist/         populararticles.php?page=$2
    32. RewriteRule ^(.*)searchresult/        indexser.php?page=$2
    Everything worked fine. I am now in the process of setting up a vps running
    PHP Version 5.1.6 and everything that uses mod rewrite gets a 404 not found error. Mod rewrite is enabled on the server, other that that I am clueless what to do at this point. Any help would be greatly appreciated.
     
    jred2002, Jan 25, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,128
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #2
    When you say "enabled", did you create a phpinfo(); page just to check?

    Jay
     
    jayshah, Jan 25, 2008 IP
  3. jred2002

    jred2002 Peon

    Messages:
    160
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes I did - mod_rerwite is listed in the Loaded Modules
     
    jred2002, Jan 25, 2008 IP
  4. jayshah

    jayshah Peon

    Messages:
    1,128
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Did you check your .htaccess file is actually being read?

    Try adding:

    Code (Text):
    1. deny from all
    To the top of the .htaccess file and refresh your site. If it loads normally, your .htaccess file isn't being read by the server prior to the request (httpd.conf problem). If you get a "403 Forbidden", that's a good thing (sort of), it just means something is wrong with your .htaccess file.

    Don't forget to remove the "deny from all" line. Please post your results here.

    Jay
     
    jayshah, Jan 25, 2008 IP
  5. jred2002

    jred2002 Peon

    Messages:
    160
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You are correct - I did just what you said and the page still loads fine.
     
    jred2002, Jan 25, 2008 IP
  6. jayshah

    jayshah Peon

    Messages:
    1,128
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #6
    :)

    Right, as you've probably guessed, this means that the httpd.conf file is configured not to AllowOverrides therefore the .htaccess file is being ignored. The only solution is to contact your hosting provider about it.

    Hope this helps,

    Jay
     
    jayshah, Jan 25, 2008 IP
    jred2002 likes this.
  7. jred2002

    jred2002 Peon

    Messages:
    160
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    IT WORKED!!!!! It's my vps - so I was able to go in and configure whatever I want - and it worked - thank you so much
     
    jred2002, Jan 25, 2008 IP
  8. jayshah

    jayshah Peon

    Messages:
    1,128
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #8
    You're welcome, but a positive reputation wouldn't go unmissed, not that I'm hinting anything ;)

    Jay
     
    jayshah, Jan 25, 2008 IP