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
    
    # -FrontPage-
      
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
      
    <Limit GET POST> 
    order deny,allow 
    deny from all 
    allow from all 
    </Limit> 
    <Limit PUT DELETE> 
    order deny,allow 
    deny from all 
    </Limit> 
    
    #php_flag session.use_trans_sid off
    
    RewriteEngine On 
    
    RewriteCond %{HTTP_HOST} . 
    RewriteCond %{HTTP_HOST}  !^www\. [NC] 
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1  [R,L]
      
    RewriteRule ^profile\/([^\/]+)/([0-9]+)     publicprofile.php?name=$1&id=$2     
    RewriteRule ^Category\/[^\/]+/([0-9]+)      index.php?catid=$1&mode=category    
    RewriteRule ^Article/[^\/]+/([0-9]+)/?(.*)  article.php?id=$1&act=$2            
    RewriteRule ^rss/[^\/]+/([0-9]+)            rssarticle.php?id=$1                
    RewriteRule ^myarticles/(.*)$               index.php?mode=myarticles 
    
    RewriteRule ^(.*)topauthorslist/	  topauthors.php?orderby=$1&ordertype=$2&namelike=$3&page=$4
    RewriteRule ^(.*)popularlist/	      populararticles.php?page=$2
    RewriteRule ^(.*)searchresult/	      indexser.php?page=$2
    PHP:
    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:

    deny from all
    Code (markup):
    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