Find the answer to your Linux question:
Results 1 to 8 of 8
I am switching over to a new server and I edited the httpd.conf file to be similar to my old server. I have a mod rewrite rule to remove .php ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    12

    Remove Extensions "Not Found" Error??


    I am switching over to a new server and I edited the httpd.conf file to be similar to my old server. I have a mod rewrite rule to remove .php extensions, which does work - but when it rewrites to http://domain.com/index I get a Not Found 404 error. Just going to http://domain.com will bring up the file, but if I try to access any files, it will rewrite and remove the extension properly, but I will get a 404 error for that file.

    I set DefaultType application/x-httpd-php - Not sure if this is an Apache or PHP problem.

  2. #2
    Just Joined!
    Join Date
    Jan 2009
    Posts
    12
    Follow up: I don't think this is an issue with the rewrite rule, as it is working as far as removing the extension. But I am getting a Not Found error thereafter.

    Could this be an issue with the DefaultType or MIME

    Rewrite rule, just in case:
    Code:
      RewriteEngine On
    	RewriteBase /
    	Options Indexes FollowSymLinks
    	AllowOverride None
    #
    # Remove ".php" 
    	RewriteCond %{THE_REQUEST} ^GET\ ([^\?]+)\.php.*(.*)\ HTTP
    	RewriteRule (.+)\.php.*(.*)$ $1$2 [R,L]

  3. #3
    Linux Newbie
    Join Date
    Apr 2008
    Location
    India
    Posts
    170
    Regards
    David Anand
    -->Success is the list of failures ...!!!

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Jan 2009
    Posts
    12
    Quote Originally Posted by davidanand View Post
    I don't think it is a rewrite issue. I think it is an Apache issue.

    Has anyone experience this at all?

  6. #5
    Just Joined!
    Join Date
    Jan 2009
    Posts
    12
    Anyone have any ideas?? Is this an Apache issue?

  7. #6
    Linux Newbie
    Join Date
    Apr 2008
    Location
    India
    Posts
    170
    Hello.

    post the error logs form Apache ..
    Regards
    David Anand
    -->Success is the list of failures ...!!!

  8. #7
    Just Joined!
    Join Date
    Jan 2009
    Posts
    12
    Quote Originally Posted by davidanand View Post
    Hello.

    post the error logs form Apache ..
    I enter info.php, it rewrites and removes the extension so you have http://domain.com/info - then it give Not Found error

    So the rewrite seems to be working, but it seems to not be properly translating the extension when it is gone.

    Log:
    Code:
    [Thu Feb 05 22:35:43 2009] [error] [client] script '/var/www/html/info' not found or unable to stat
    [Thu Feb 05 22:35:43 2009] [error] [client] script '/var/www/html/error' not found or unable to stat

  9. #8
    Just Joined!
    Join Date
    Jan 2009
    Posts
    12
    Figured it out. Needed to add Options +Multiviews

    Didn't have this on the old config on OS X and it worked. Crazy.

    At least it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •