Forum Moderators: phranque

Message Too Old, No Replies

forcetype not working

trying to call a PHP file without the extension

         

peoplesoft

3:41 pm on Aug 19, 2009 (gmt 0)

10+ Year Member



My existing .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
<Files process>
forcetype application/x-httpd-php
AcceptPathInfo On
</Files>
RewriteBase /CI-Directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /CI-Directory/index.php/$1 [L,QSA]
</IfModule>

I have a file named process.php in the /CI-Directory. I am trying to call this file without the .php extension like this:

[mywebsite.com...]

But keep getting 404 error:

I really hope someone can help me with this one..

g1smd

7:07 pm on Aug 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



1. The .* pattern matches "anything" so will cause you multiple duplicate content issues. You need a more exact pattern here.

2. The -d and -f checks are very server intensive. By careful coding of point one they could both probably be omitted.

We need to see an example of the URL that you advertise on the web, and the matching local filepath of the file inside the server that processes the request.

Your current example is unclear, and open to misinterpretation.

At present a URL request for

example.com/CI-Directory/process?param1=0
will be rewritten so that the server is looking for the data inside the server at
/CI-Directory/index.php[b]/[/b]CI-Directory/process?param1=1
and that makes no sense at all. There's a load of redundant junk in the URL, and the "process" parameter is not being passed in any sensible way to the file "index.php".

This needs a rethink. Define the operation of the URLs and the internal filepaths before starting to code anything at all.

g1smd

7:11 pm on Aug 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I see you are also trying stuff in: [webmasterworld.com...]

This split discussion will end up confusing both you and us.

peoplesoft

3:55 am on Aug 20, 2009 (gmt 0)

10+ Year Member



hi g1smd,

I am not pursuing the other thread any more.. and more keen on getting my outcome using forcetype approach (mentioned here).

My CI-Directory is here:
/www/CI-Directory/
My Files:
/www/CI-Directory/.htaccess
/www/CI-Directory/process.php
/www/CI-Directory/index.php

Other source files which need index.php to work: (index.php is acting as a Front controller here)
/www/CI-Directory/system

Don't know how to AVOID process.php being parsed by index.php. Unfortunately I am very green when it comes to htaccess rules.. still learning.

jdMorgan

4:10 am on Aug 20, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




RewriteRule ^process$ process.php [L]

Placed before your current rule will take a client request for the URL-path "process" and send it to the file "process.php."

Jim

peoplesoft

5:57 am on Aug 20, 2009 (gmt 0)

10+ Year Member



Excellent!
Thank you very much Jim.