PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 15, 2022

[FIXED] Forcetype in httpd.conf not working

 March 15, 2022     apache, friendly-url, httpd.conf, lamp, php     No comments   

Issue

I want to use pretty url. So I searched net and tried to use the forcetype approach.

httpd.conf:

<Files "main">
    ForceType application/x-httpd-php
</Files>

ls htdocs/
favicon.ico  index.php  main.php  webalizer  xampp

But this doesnot work. I tried to find the solution, as suggested I also tried following:

<Files "main">
    ForceType application/x-httpd-php5
</Files>

<Files "main">
    ForceType application/x-httpd-php
    SetHandler application/x-httpd-php
</Files>

<Files "main">
    ForceType application/x-httpd-php5
    SetHandler application/x-httpd-php5
</Files>

But nothing work. I am still getting 404 error on opening http://localhost/main.

(http://localhost/main.php is working fine.) I am using xampp-linux-1.8.1 on Linux abhi-me 3.0.0-31-generic #49-Ubuntu SMP Tue Feb 19 20:02:57 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Why this is happening?


Solution

Just because you are trying to force the handler to be PHP5 doesn't mean that Apache will magically find a file named /main.php at /main.

You could simply rename main.php to main (while still having these handler rules in place) to make this work. Otherwise if you want to keep the .php extension on your file, you will need to look at using a rewrite directive.



Answered By - Mike Brant
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing