Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Problem with Rewrite's and htaccess?  (Read 2342 times)

bwebb

  • Newbie
  • *
  • Karma: 0
  • Posts: 5
Problem with Rewrite's and htaccess?
« on: December 06, 2006, 04:08:21 pm »

All,

I have finally gotten my page hosted on my webserver, but I am still having a problem with pages other than 'Home' in the menu items section.

Before I get started, here is a link to the site: http://thewebbsite.redirectme.net/

If you click on the link, you get to the home page just fine.  However, if you click on one of the menu item links on the right hand side (i.e. Archive, Contact) you get a page with no css styling.  On the other hand, if you paste the folloing into the URL address bar:

http://thewebbsite.redirectme.net/index.php?action=archive

or

http://thewebbsite.redirectme.net/index.php?action=contact

the pages come up just fine, with css and all.  I know that this is completely inappropriate, but just for troubleshooting's sake, I altered the following line in snews.php

Code: [Select]
// DISPLAY MENU ITEMS
function menu_items() {
.
.
 echo "
  • " .l('contact'). "
  • "; ?>
    to

    Code: [Select]
    // DISPLAY MENU ITEMS
    function menu_items() {
    .
    .
     echo "
  • " .l('contact'). "
  • "; ?>
    and of course, clicking on the menu item link 'Contact' from the home page takes you to the contact page and the css works just fine.  I have left it as is for demonstration purposes only.

    Here is a copy of my current .htaccess file:

    Code: [Select]
    AddType text/css .css

            php_value session.use_trans_sid 0

    RewriteEngine On
    RewriteRule ^categories/$ index.php?category=categories [L,QSA]
    RewriteRule ^contact/$ index.php?category=contact [L,QSA]
    RewriteRule ^images/$ index.php?category=images [L,QSA]
    RewriteRule ^login/$ index.php?category=login [L,QSA]
    RewriteRule ^logout/$ index.php?category=logout [L,QSA]
    RewriteRule ^new/$ index.php?category=new [L,QSA]
    RewriteRule ^rss/$ index.php?category=rss [L,QSA]
    RewriteRule ^unpublished/$ index.php?category=unpublished [L,QSA]

    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^(.*) $1 [L]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ index.php?category=$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-z_]+)/([^/]+)/ index.php?category=$1&title=$2 [L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-z_]+)/([^/]+)/([^/]+)/ index.php?category=$1&title=$2&commentspage=$3 [L]
    The files (index.php, snews.php, etc.) are located in my html root directory (/var/www/html), so I have left the 'RewriteBase /' out of the .htaccess file, although it doesn't seem to make a difference either way.

    Here are the top few lines of my snews.php file:

    Code: [Select]
    //******************
    // GLOBAL SETTINGS
    //******************

    $s['username'] = "username"; // Enter your administration username
    $s['password'] = "password"; // Enter your administration password

    $s['dbhost'] = "localhost"; // MySQL host
    $s['dbname'] = "nolimit"; // Database name
    $s['dbuname'] = "myname"; // Database Username
    $s['dbpass'] = "mypass"; // Database password
    $s['dberror'] = "There was an error while connecting to the database.
     Check your database settings."; // Database error message
    $s['prefix'] = ""; // Table prefix for multiple sNews systems on one database (if you don't need it just leave it blank)

    $s['home'] = "home"; // Enter blog title like home or blog
    $s['display_new_on_home'] = False; // Display new articles from all categories on home (True or False)
    $s['website'] = "http://thewebbsite.redirectme.net/"; // Website url with the trailing slash
    $s['website_title'] = "Bret M. Webb"; // Website title
    I do have mod_rewrite enabled and I do have 'AllowOveride All' set in my httpd.conf file.  Any suggestions?  I have been searching the forums for a few hours and have found discussions on problems similar to mine, but their solutions did not fix my problem.  I am guessing it is a problem with my .htaccess file and the Rewrite rules contained therein.

    Thanks in advance,

    Bret
    Logged

    Keyrocks

    • Doug
    • ULTIMATE member
    • ******
    • Karma: 449
    • Posts: 6020
    • Semantically Challenged
      • snews.ca
    Problem with Rewrite's and htaccess?
    « Reply #1 on: December 06, 2006, 04:40:32 pm »

    Well... at first glance... it would appear that this line at the top of your .htaccess file
    Quote
    AddType text/css .css
    may be causing a problem. Try relocating it to the bottom of the file. There should be no other active string above the session opening strings
    Quote

            php_value session.use_trans_sid 0
    The server needs to parse strings in a certain order, and it must open the session before it parses the rest of the file.
    Logged
    Do it now... later may not come.
    -------------------------------------------------------------------------------------------------
    sNews 1.6 MESU | sNews 1.6 MEMU

    Patric Ahlqvist

    • Nobodys perfect, but Im pretty effing close
    • ULTIMATE member
    • ******
    • Karma: 65
    • Posts: 4867
    • I'm a self-made man and worships my creator.
      • p-ahlqvist.com
    Problem with Rewrite's and htaccess?
    « Reply #2 on: December 06, 2006, 04:44:15 pm »

    Hi, bwebb and welcome from me, don't think I've said that...': )

    You're in frames... I don't know, but it feels like that would cause a problem... I'll let Key's answer that ;)
    Logged
    "It's only dead fish that goes with the flow... "
    Updated

    bwebb

    • Newbie
    • *
    • Karma: 0
    • Posts: 5
    Problem with Rewrite's and htaccess?
    « Reply #3 on: December 06, 2006, 04:57:19 pm »

    Okay, good call... I had mentally blocked that out.  It looks like my http redirect provider pops my page into a set of frames so that they can have their advertisements at the bottom of the page.  Perhaps if I 'upgrade' my service from free they won't tag my site with frames.  I see how the sNews redirects may not work in a set of frames... yes, very interesting indeed.

    -bmw

    Edit:

    Anyone have a suggestion for a frameset workaround?  Could this be accomplished by modifying the snews.php file?
    Logged