Nov 21, 2009

Linux/ Apache /mod_rewrite Issue - Error when accessing a file

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > PHP Programming

Linux/ Apache /mod_rewrite Issue - Error when accessing a file

jlhaslip
running on Ubuntu 8.04 with an XAMPP - php5.2.5, Apache 2., etc

Getting this error when I try to access an sNews CMS which requires mod_rewrite and is installed locally:
QUOTE

[Mon Sep 22 05:46:00 2008][notice] Apache/2.2.8 (Unix) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8e PHP/5.2.5 mod_apreq2-20051231/2.6.0 mod_perl/2.0.2 Perl/v5.10.0 configured -- resuming normal operations
[Mon Sep 22 06:15:29 2008] [alert] [client 127.0.0.1] /opt/lampp/htdocs/jim/snews/.htaccess: RewriteBase: argument is not a valid URL
[Mon Sep 22 06:20:43 2008] [alert] [client 127.0.0.1] /opt/lampp/htdocs/jim/snews/.htaccess: RewriteBase: argument is not a valid URL


Using this link: http://localhost/jim/snews/snews16_email/ with an .htaccess is as follows:
QUOTE

<IfModule mod_php4.c>
php_value session.use_trans_sid 0
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
RewriteEngine On
RewriteBase /snews/snews16_email
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]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9_-]+)/([0-9]+)/ index.php?category=$1 articlespage=$2 [L]


I have tried all combinations of the rewriteBase imaginable, but still can't get the Internal Error to go away. Combinations from home/jim/www/snews/snews16_email to snews/snews16_email .

The folder being used to contain the files is not in the htdocs folder, I have a symbolic link (short-cut) pointing to a User account folder instead.
Is this the issue? and how do I overcome this problem so that I can test locally? The Server works flawlessly for applications not requiring the mod-rewrite, so it seems to be an issue in the handling of the short-cut, I think.

Thanks for having a look.

 

 

 


Comment/Reply (w/o sign-up)

truefusion
Try this:

Replace the RewriteBase line with this one:
CODE
RewriteBase /jim/snews/snews16_email

Comment/Reply (w/o sign-up)

jlhaslip
QUOTE(truefusion @ Sep 22 2008, 12:21 PM) *
Try this:

Replace the RewriteBase line with this one:
CODE
RewriteBase /jim/snews/snews16_email

fails with the same error.
I have used that and several other combinations to no avail... including /jim/www/snews... etc

Comment/Reply (w/o sign-up)

truefusion
Hmm. Have you also tried these?:
/snews
/jim/snews

If so, try just commenting out the line. I've installed sNews on my side, and it works with and without RewriteBase (if RewriteBase is /snews, that is).

Messing around with it, i tried /snews2 for RewriteBase, and clicking on the links says that it can't find /snews2/index.php. If i comment out the RewriteBase line, everything works again. I haven't fully studied the source code yet, but it seems that if RewriteBase is commented out, it defaults to $db['website'].

Comment/Reply (w/o sign-up)

jlhaslip
Issue Resolved...
(simply deleted the .htaccess file in the folder above)
Seems that the .htaccess (and mod-rewrite) is hierarchical. Top Dog wins.

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : linux, apache, mod, rewrite, issue, error, accessing, file

  1. Php - Fetching Random Line From A Text File
    and displaying it using AJAX/iframe (0)
  2. Getting Php Error On Oscommerce
    (3)
    ok i installed oscommerce on my hosting and i got a template that im trying to isntall on it but
    when i go to the install folder it says Server Requirement Error: register_globals is disabled in
    your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess
    file in your catalog directory. and register_globals is enabled in .htaaccess i cannot find php.ini
    sumone PLZZZ help me!!!....
  3. Installing Php Pear On Linux
    (0)
    I recently installed PEAR into a PHP environment on a Linux machine, and as I did the installation I
    wrote down the steps for future use. I thought it might be useful for others. PEAR stands for PHP
    Extension and Application Repository. Basically I just use it for replacing php database connection
    functions. Download the go-pear.php script from http://go-pear.org/ . Open a command line shell
    and run the script: php go-pear.php QUOTE Welcome to go-pear! Go-pear will install the
    'pear' command and all the files needed by it. This command is your tool for ....
  4. Mysql Error
    (3)
    ok i need some more help from the wonderful coders here at Trap. I'm almost done with my CMS
    script, but i'm having a problem with the installer.php file, when it trys to inseret the user
    data into the database i keep getting the following error: CODE mySQL Error: You have an error
    in your SQL syntax; check the manual that corresponds to your MySQL server version for the right
    syntax to use near ';INSERT INTO `members` (`id`, `name`, `username`, `password`, `email`,
    `title`) ' at line 1 the code that is being excuted by the php file is this: C....
  5. Registration Form?!
    Password Issue??? (6)
    How can I build the registration form with some additional function which is illustrated by attached
    file. When a user tries to type a password, that bar thing says neither it's strong nor weak, or
    medium. Just take a look at attachment....
  6. Php Configuration File
    "config.php" (18)
    I did create this topic mainly because I want to know everything about that configuration file. I
    will post other replies if I want to know more depending on your experience. Is this code correct
    for that file: CODE $host="localhost"; $dbname="XXX"; $dbuser="XXX"; $dbpass="XXX";
    $connection=mysql_connect($host, $dbuser, $dbpass) or die(mysql_error()); mysql_select_db($dbname)
    or die(mysql_error()); ?> Add your suggestions or improve it.....
  7. Need Some Help In File Browser
    listing all sub folders and files in them. (8)
    Hey I want to create a very simple file browser, so that, it reads all the sub-folders which are
    places in a directory, and the files inside the sub-folders (It reads only files inside sub-folders
    and list them in simply. ) Also, it creates a directory (any name) inside each sub folder. My
    Following code reads on the files inside the main directory, it does not read the files inside the
    sub-folders.. I appreciate any help. CODE $path = "./"; $dir_handle = @opendir($path) or
    die("Unable to open $path"); while ($file = readdir($dir_handle)) { if($file == "." || $fil....
  8. Updating Php File Through A Web Form
    (5)
    Hello, i'm not sure if this can be done with php or not but what i need is a way to make an php
    file that have an html form on it and it will take the info you put in to that form and write it to
    an existing php file, for example: if i have the file news.php and the file news_update.php. if you
    went to news_update.php you would get an form with a text area for you to write a new addition for
    the news.php file and when you hit submit it will add what you typed in the form to the file
    news.php. If this is going to be a big code or a hard one to make but some one think....
  9. Php Objects: Catchable Fatal Error
    There is a weird problem with objects in php 5.2.2 (4)
    in php 4.4.7 my code seems to be ok but in later version 5.2.2 i get this error Catchable fatal
    error: Object of class mission_rank could not be converted to string in
    /Applications/xampp/xamppfiles/htdocs/nexus/includes/forms/cn_reload.php on line 41 cn_reload.php
    include('../class/userClass.php'); session_start(); $app_user =& $_SESSION ; if
    ($app_user->character != false) { $race_letter =
    array('H','E','T','M','G'); $cn_id = 0; foreach
    ($app_user->character as $character) { // div container ....
  10. File Checker-how To Check File Whith Html Through Html?
    (2)
    edit:sorry for the mistake it is php not html and its with not whith my code checking script= CODE
    $file = '$CHECK'; if (file_exists($file)) {     echo "The file $filename exists"; } else
    {     echo "The file $filename does not exist"; } ?> my question is how to check the file whith
    html example:on a page a text box is provided and a button the user writes a file name (or website)
    the user clicks on the submit button then it checks and show it (with the code above) i got the
    code CODE $filename=$_POST ; if (file_exists($filename)) {     echo "The....
  11. Wamp Packages Needed To Test Scripts
    Set up Apache, PHP, etc on your machine (1)
    In order to test php scripts on your localhost machine, you require a system that includes php
    parsing. A WAMP set-up 'usually' includes a database server, and a database manager, too.
    For Windows machines, theses are usually referred to as WAMP because they include Apache, Mysql, and
    PHP for Windows, hence the acronym WAMP. Wikipedia has a listing of the available packages with
    details about the included versions and often a link to the wikipedia article describing them. The
    list can be found at http://en.wikipedia.org/wiki/Comparison_of_WAMPs Personally, I....
  12. Php And Flash Image Gallery
    Need some help in creating or editing an xml file while viewing some o (5)
    Hello there and thanks for the helping hand you are offering. PHP newbie here! /ph34r.gif"
    style="vertical-align:middle" emoid=":ph34r:" border="0" alt="ph34r.gif" /> So here is my problem:
    On my website I have a flash image gallery.The way the gallery works is by uploading pictures in a
    folder and editing? an xml file.(pics.xml) where it adds the following code when you upload a
    picture: CODE           etc... Now I have users that upload products they sell on the
    website or they advertise their business(hotels, jewellers, car resellers,...) So for eve....
  13. No File Extension
    (3)
    On MediaWiki, the URL of the content is http://YOURWIKI.com/index.php/Blah Is it possible to
    create a page or two that doesn't have a file extension? If so, how is it done?....
  14. T_string Error Please Assist
    (5)
    I have unexpected t_strings in 3 lines they are CODE // $Header$ //this script may only be
    included - so its better to die if called directly. if (strpos($_SERVER ,basename(__FILE__)) !==
    false) {   header("location: index.php");   exit; } /* A basic library to handle a cache of some
    Tiki Objects, usage is simple and feel free to improve it */ class Cachelib {   var $folder;
      function Cachelib() {         global $tikidomain;         $this->folder = "temp/cache";         if
    ($tikidomain) {             $this->folder.= "/$tikidomain";         }     if(!is_dir(....
  15. File Upload
    File upload (1)
    I need to add a facility on my customer's website so his clients can send him jobs, typically
    5mb - 50mb. I've looked around the web and researched this, and tried a few tests (failed), but
    my brain's beginning to hurt. Could someone please tell me the best way to go about this,
    please. The site is done in Flash, but I'm sure a link to an html page would be ok if necessary.....
  16. Eclipse Php And Apache
    Eclipse php and Apache (1)
    Hi, I have apacher server installed already and was wondering if I can use it for Eclipse php
    testing. Is there a away to tell Eclipse php to use existing apache? I've looked in the
    preference of Eclipse and I can't find a standard apacher server (Apache HTTP Server Version
    2.2); it has like tom cat and other servers. ....
  17. Php Pages Permission On Apache Server
    PHP pages permission on Apache Server (1)
    Hello, I want to know what permissions for PHP pages should be given on Apache web server so that
    PHP pages can be executed. If PHP pages are in a folder, what permissions should be given for that
    folder? ....
  18. Security Issue Writing Files
    Security issue writing files (1)
    Hi, first, sorry about my english. i am a beginner with php and i have some question about writing
    files using php in a shared hosting. is a risk?, use database to store data is a better way? i just
    want make an interface (in php) that write the data in a .html extension file to show to everybody
    the html page and just the php interface is to the content manager. thanks in advance ....
  19. <?php ?> Unique Visitors Script
    Flat file unique visitors script (no sessions) (2)
    This is really simple script. Well at least this part is, but it could be extendable. Only problem
    is that it's not really for massive websites with hundread of visitors a day, but rather for
    small ones. But it is a good script to figure out how to make a visitor counter script. Anyway
    here's the snippet. CODE function getVisits($variable) {     $visits = array();     if
    ($handle = opendir('stats/')) {     while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {             array_push($visits, $file);         } ....
  20. Apache Default Port
    How to change it? (7)
    I need help to know how to change the port number of Apache server which is I think Port:80, note
    that I'm using XAMPP Control Panel. and thanks in advance /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />....
  21. Dealing With Links Like ?id=123
    pls help in a small issue (7)
    While dealing with such a links in php CODE page.php?id=1 i dont want that someone access
    this page directly using page.php.. i can give some custom message incase someone try to access
    page like: CODE page.php okay i can make it by using if condition etc.. but the other problem
    is that, if someone try to access like, CODE page.php?id= in this case (where id is not
    given, but there's only "?id= " which makes no sense.. in that case i want to make some custom
    msg etc. how i can handle this situation? Regards ....
  22. Include File.php?id=something
    using the include() function (13)
    Well, I am making a full CMS system for my site, and want to make the index.php file to include the
    view.php?id=1 file. I tried with this code, but it didn't work: CODE This is the error
    I get: CODE Warning: main(view.php?id=1) : failed to open stream: Invalid argument in
    C:\server\xampp\htdocs\test\index.php on line 1 Warning: main() : Failed opening
    'view.php?id=1' for inclusion (include_path='.;C:\server\xampp\php\pear\') in
    C:\server\xampp\htdocs\test\index.php on line 1 So what can I do?....
  23. Parse: Error Unexpected T_lnumber
    php parse error when running script (4)
    Hi. I've just created a php script. The main object of the script is to delete some old files
    and replace it with a new file with some new content, effectively moving the contents from one file
    to another. These are the first 50 lines of the file: /* Calculate For The "A" Group - The
    Latest Games ID */ $a_B = 002; while(file_exists("a_" . $a_B . ".dat")) { $a_B++; }
    $new_page_contents = " " . $_POST . " " . $_POST . " include
    \"/home/cmatcme/public_html/footer.php\"; ?> "; $a_stream = fopen($a_B . ".cmat", "w+");
    fwri....
  24. File Uploading Issues
    (5)
    i have never tried to have files uploaded and i am still not able to do so. here is the codes that i
    am using right out of the php manual and it still isnt working. i have also listed the
    warnings/errors listed on the resulting page. my permissions are set to 777 also. i have a folder
    set up on my server as "uploads". i am however not sure if i have a default temp folder on my
    server. can anyone help me figure out what i am not doing correctly or what my next step is? this
    is the form that i am using: html Code: CODE        Choose a file to upload:     ....
  25. Php5 And Apache Tomcat 5.x
    PHP5 with Apache Tomcat 5.x (3)
    Hello I'm working with JAVA and i want to use in the same application some of the prefabricated
    alications like Drupal, or PHPNuke, that are made with PHP, to make this i have to install PHP5
    (last version) and make it ork with my tomcat web server(ver 5.5.9 last version too, i think), but
    in the documentatio of PHP they mention tomcat versions 1.x and 2.x not the 5.x version. So the
    big question here is: How to makes work PHP5 with Apache Tomcat 5.x??? any help?? Thanks....
  26. Error When Using file_put_contents()
    failed to call to undefined function (5)
    Hey all, I decided to write a script which writes some text to a file, but I have a problem when I
    execute the script, I get a fatal error: QUOTE(homepage) Fatal error : Call to undefined
    function: file_put_contents() in /home/cmatcme/public_html/afile.php on line 55 This is the
    code I'm using to write the file: $ipfnsdoc = "/home/cmatcme/public_html/afolder/afile.txt";
    if (!is_readable($ipfnsdoc)) { echo "File cannot be read"; $stopload = 1; } if
    (!is_writable($ipfnsdoc)) { echo " \nFile cannot be written to"; $stoploa....
  27. Trouble With Emailer.php
    failed sending email error (6)
    Whenever someone registers at my forum, they get this error: Failed sending email :: PHP :: DEBUG
    MODE Line : 234 File : emailer.php however, the account will be sucessfully registered. It is
    weird because i did not change the original emailer.php at all. O__O||| anyone know whats up with
    it?....
  28. Script: Php Jukebox
    A one file script! (6)
    This scripts is so simple, you dont need to edit ANY of it! All you have to do is make a folder
    called 'songs' and put some audio files in it. Here is the whole page, I named it index.php
    and put it in a folder called 'music': CODE PHP jukebox ©2005 Craig lloyd.
    All rights reserved. Visit cragllo.com for more scripts --> /** * ©2005 Craig lloyd. All rights
    reserved. * * Mod Title:           Simple PHP Jukebox * Author:              Craig Lloyd * Author
    Email:        cragllo@cragllo.com * Author Homepage:     http://www.cragllo.com/ * Des....
  29. Getting List Of Directories And Files Using Php
    PHP Function for Directory and File List (6)
    is there a php function that lists the content of some folder.... example: /New folder new.txt
    left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
    style='vertical-align:middle' alt='rolleyes.gif' /> ....
  30. Pages In 1 File
    ?? (10)
    I know its possible to put many pages inside 1 file. But how? Lets say you have a guestbook with
    different pages for signing and viewing. How to make so those pages are in 1 file? /huh.gif"
    style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" />....

    1. Looking for linux, apache, mod, rewrite, issue, error, accessing, file
Similar
Php - Fetching Random Line From A Text File - and displaying it using AJAX/iframe
Getting Php Error On Oscommerce
Installing Php Pear On Linux
Mysql Error
Registration Form?! - Password Issue???
Php Configuration File - "config.php"
Need Some Help In File Browser - listing all sub folders and files in them.
Updating Php File Through A Web Form
Php Objects: Catchable Fatal Error - There is a weird problem with objects in php 5.2.2
File Checker-how To Check File Whith Html Through Html?
Wamp Packages Needed To Test Scripts - Set up Apache, PHP, etc on your machine
Php And Flash Image Gallery - Need some help in creating or editing an xml file while viewing some o
No File Extension
T_string Error Please Assist
File Upload - File upload
Eclipse Php And Apache - Eclipse php and Apache
Php Pages Permission On Apache Server - PHP pages permission on Apache Server
Security Issue Writing Files - Security issue writing files
<?php ?> Unique Visitors Script - Flat file unique visitors script (no sessions)
Apache Default Port - How to change it?
Dealing With Links Like ?id=123 - pls help in a small issue
Include File.php?id=something - using the include() function
Parse: Error Unexpected T_lnumber - php parse error when running script
File Uploading Issues
Php5 And Apache Tomcat 5.x - PHP5 with Apache Tomcat 5.x
Error When Using file_put_contents() - failed to call to undefined function
Trouble With Emailer.php - failed sending email error
Script: Php Jukebox - A one file script!
Getting List Of Directories And Files Using Php - PHP Function for Directory and File List
Pages In 1 File - ??

Searching Video's for linux, apache, mod, rewrite, issue, error, accessing, file
See Also,
advertisement


Linux/ Apache /mod_rewrite Issue - Error when accessing a file

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com